:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --primary-light: #e0e7ff;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f0f12;
  --card: #1a1a1f;
  --text: #f0f0f0;
  --muted: #888;
  --border: rgba(255,255,255,0.08);
}

[data-theme="light"] {
  --bg: #f9fafb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}

/* =========================
   TOPBAR
   ========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: rgba(255,255,255,0.18); }
.icon-btn:active {
  background: rgba(255,255,255,0.25);
  transform: scale(0.92);
}
.icon-btn .icon { width: 22px; height: 22px; flex-shrink: 0; }

.theme-toggle { color: #fff; }
.theme-toggle .theme-icon { display: none; }
.theme-toggle .theme-icon.active { display: block; }
.theme-toggle svg { width: 22px; height: 22px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.brand-logo { text-decoration: none; }
.brand-logo .logo-img { height: 44px; width: auto; display: block; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
  border: 2px solid rgba(255,255,255,0.3);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* =========================
   CONTAINER
   ========================= */
.container {
  padding: 16px 16px 92px;
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100vh - 56px - 72px);
}

/* =========================
   CARDS E OFERTAS
   ========================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 12px;
}

/* Cabeçalho de página */
.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.page-atalho-estoque {
  margin-top: 12px;
  width: 100%;
}

.estoque-modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.estoque-modal-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.estoque-modal-item:last-child {
  border-bottom: none;
}

.estoque-modal-cat {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.estoque-modal-qty {
  font-weight: 800;
  font-size: 16px;
  color: var(--primary);
  flex-shrink: 0;
  line-height: 1.2;
}

.oferta-card {
  position: relative;
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.oferta-card:active {
  transform: scale(0.98);
}

.oferta-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  margin-top: 6px;
}

.oferta-timer-expired {
  color: var(--danger);
}

.oferta-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.oferta-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.oferta-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.oferta-valor {
  text-align: right;
}

.oferta-preco {
  font-size: 24px;
  font-weight: 900;
  color: var(--success);
  line-height: 1;
}

.oferta-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.oferta-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.info-icon {
  font-size: 18px;
}

.info-text {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-value {
  font-weight: 600;
  color: var(--text);
}

/* =========================
   BOTÕES
   ========================= */
.btn {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn .inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn .inline-icon svg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:active {
  transform: translateY(1px);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 2px solid var(--danger);
}

.btn-danger:active {
  background: #fef2f2;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:active {
  background: #f3f4f6;
}

/* =========================
   ENTREGA ATIVA
   ========================= */
.entrega-ativa {
  background: linear-gradient(135deg, var(--primary-light) 0%, #ffffff 100%);
  border: 2px solid var(--primary);
  padding: 20px;
}

.entrega-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.gps-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9ca3af;
}

.gps-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

.entrega-cliente {
  background: var(--card);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.cliente-nome {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cliente-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.mapa-container {
  width: 100%;
  height: 280px;
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid var(--border);
}

/* Em tela cheia: wrapper e mapa preenchem a tela (evita faixa preta no desktop) */
#mapaContainerWrap:fullscreen,
#mapaContainerWrap:-webkit-full-screen,
#mapaContainerWrap:-moz-full-screen,
#mapaContainerWrap.mapa-wrap-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: stretch !important;
  align-items: stretch !important;
  border-radius: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
#mapaContainerWrap:fullscreen .mapa-container,
#mapaContainerWrap:-webkit-full-screen .mapa-container,
#mapaContainerWrap:-moz-full-screen .mapa-container,
#mapaContainerWrap.mapa-wrap-fullscreen .mapa-container {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  border-radius: 0;
}
/* Fallback: altura em vh para o mapa preencher em qualquer fullscreen */
#mapaContainerWrap.mapa-wrap-fullscreen .mapa-container {
  min-height: 100vh;
}

/* Botões de zoom fixos (fora do container que rotaciona) – sempre visíveis no modo motorista */
.mapa-zoom-controls {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.mapa-zoom-controls .mapa-zoom-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #1a1a1a;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.mapa-zoom-controls .mapa-zoom-btn .mapa-btn-ic {
  width: 22px;
  height: 22px;
  display: block;
}
.mapa-zoom-controls .mapa-zoom-btn:hover { background: #f0f0f0; }
.mapa-zoom-controls .mapa-zoom-btn:active { transform: scale(0.95); }
.mapa-zoom-controls .mapa-zoom-btn#mapaZoomOut { font-size: 24px; }
.mapa-zoom-controls .mapa-zoom-btn-icon.mapa-zoom-btn-reset,
.mapa-zoom-controls .mapa-zoom-btn-icon.mapa-zoom-btn-fullscreen,
.mapa-zoom-controls .mapa-zoom-btn-icon.mapa-zoom-btn-recalcular {
  padding: 0;
  font-size: 0;
}
.mapa-zoom-controls .mapa-zoom-btn-recalcular:disabled { opacity: 0.6; cursor: not-allowed; }

/* Pins do mapa – mesmo padrão do app cliente (caixa colorida + ícone SVG + texto) */
.leaflet-div-icon.map-pin-custom {
  background: none !important;
  border: none !important;
}
.leaflet-div-icon.map-pin-custom > div {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  justify-content: center;
  align-items: center;
  overflow: visible;
}
.leaflet-div-icon.map-pin-custom .pin {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border: 2px solid #fff;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff !important;
}
.leaflet-div-icon.map-pin-custom .pin-icon {
  flex: 0 0 20px !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  overflow: hidden;
}
.leaflet-div-icon.map-pin-custom .pin-icon svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  flex-shrink: 0;
  color: #fff !important;
  stroke: #fff !important;
  fill: none;
}
.leaflet-div-icon.map-pin-custom .pin-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.leaflet-div-icon.map-pin-custom .pin-coleta {
  background: #1E88E5 !important;
  color: #fff !important;
}
.leaflet-div-icon.map-pin-custom .pin-entrega {
  background: #2ECC71 !important;
  color: #fff !important;
}
.leaflet-div-icon.map-pin-custom .pin-voce {
  background: #FF6A00 !important;
  color: #fff !important;
}

/* Mesmo visual no Google Maps (overlay com quadrinhos) */
.map-pin-custom.pin {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border: 2px solid #fff;
  box-sizing: border-box;
  color: #fff !important;
}
.map-pin-custom.pin .pin-icon,
.map-pin-custom .pin-icon {
  flex: 0 0 20px; width: 20px; height: 20px; min-width: 20px; min-height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.map-pin-custom.pin .pin-icon svg,
.map-pin-custom .pin-icon svg {
  width: 20px; height: 20px; min-width: 20px; min-height: 20px;
  stroke: #fff; fill: none;
}
.map-pin-custom.pin.pin-coleta { background: #1E88E5 !important; }
.map-pin-custom.pin.pin-entrega { background: #2ECC71 !important; }
.map-pin-custom.pin.pin-voce { background: #FF6A00 !important; }

.pin-input-box {
  background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
  border: 2px solid var(--warning);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  text-align: center;
}

.pin-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.pin-input {
  width: 100%;
  padding: 16px;
  font-size: 32px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-family: 'Courier New', monospace;
}

.pin-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* =========================
   HISTÓRICO
   ========================= */
.historico-card {
  margin-bottom: 12px;
}

.historico-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.historico-pedido {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  display: block;
}

.historico-data {
  font-size: 13px;
  color: var(--muted);
}

.historico-valor {
  font-size: 18px;
  font-weight: 800;
  color: var(--success);
}

.historico-card-meta {
  font-size: 13px;
  color: var(--muted);
}

/* =========================
   GANHOS
   ========================= */
.ganhos-destaque {
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.02) 100%);
  border-color: rgba(16, 185, 129, 0.25);
}

.ganhos-destaque-label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ganhos-destaque-valor {
  font-size: 32px;
  font-weight: 900;
  color: var(--success);
  line-height: 1.2;
}

.ganhos-destaque-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.ganhos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
}

.ganhos-grid-item {
  text-align: center;
  padding: 12px 0;
  border-right: 1px solid var(--border);
}

.ganhos-grid-item:last-child {
  border-right: none;
}

.ganhos-grid-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ganhos-grid-valor {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.ganhos-grid-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.ganhos-total {
  text-align: center;
  padding: 20px;
  border: 2px solid var(--primary-light);
  background: linear-gradient(135deg, var(--primary-light) 0%, rgba(255,255,255,0.5) 100%);
}

.ganhos-total-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.ganhos-total-valor {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-dark);
}

.ganhos-total-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.ganhos-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
}

.ganhos-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ganhos-item-pedido {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.ganhos-item-data {
  font-size: 12px;
  color: var(--muted);
}

.ganhos-item-valor {
  font-size: 16px;
  font-weight: 800;
  color: var(--success);
}

/* =========================
   ESTADOS VAZIOS
   ========================= */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state .empty-icon svg {
  width: 56px;
  height: 56px;
  color: var(--primary, #6366f1);
  opacity: 0.9;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-text {
  font-size: 14px;
  line-height: 1.5;
}

/* =========================
   LOADING ELEGANTE
   ========================= */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.loading-block {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.loading-block::after {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-left: 10px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  font-weight: 400;
}

/* Skeleton (cards de oferta enquanto carrega) */
.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--border) 25%, #f3f4f6 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.2s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.tall { height: 20px; }

.skeleton-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.skeleton-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-btn {
  height: 52px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--border) 25%, #f3f4f6 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.2s ease-in-out infinite;
}

@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Botão em estado de loading */
.btn.loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn.loading::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.btn-secondary.loading::after {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--text);
}

/* Toast (feedback rápido, igual app cliente) */
.toast-wrap {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.3s ease;
  max-width: 90vw;
}

.toast.ok {
  background: var(--success);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}

.toast.err {
  background: var(--danger);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal (alert/confirm nativo para mobile - mesmo padrão do app cliente) */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: app-modal-fade-in 0.2s ease;
  box-sizing: border-box;
}
@keyframes app-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.app-modal-dialog {
  width: 100%;
  max-width: min(340px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  min-width: 0;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: app-modal-scale-in 0.25s ease;
  box-sizing: border-box;
}
@keyframes app-modal-scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.app-modal-title {
  padding: 18px 18px 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.app-modal-body {
  padding: 8px 18px 18px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}
.app-modal-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 12px 18px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  min-width: 0;
}
.app-modal-actions .btn {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  font-size: 15px;
}
.app-modal-actions.single .btn { flex: none; min-width: 120px; }
@media (max-width: 420px) {
  .app-modal-actions:not(.single) {
    flex-direction: column;
  }
  .app-modal-actions:not(.single) .btn {
    width: 100%;
    flex: none;
  }
}

/* =========================
   BOTTOM NAVIGATION
   ========================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 4px;
  transition: color 0.2s, transform 0.15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover { color: var(--text); }
.nav-item:active { transform: scale(0.94); }
.nav-item.active { color: var(--primary); }

.nav-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  transition: transform 0.2s;
}
.nav-item.active .nav-ic { transform: scale(1.08); }
.nav-ic svg { width: 24px; height: 24px; }

.nav-tx {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(12px);
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.badge-success {
  background: var(--success);
}

/* =========================
   UTILITÁRIOS
   ========================= */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }

/* Navegação (Google Maps / Waze) */
.nav-section {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.nav-section-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}
.nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.nav-row:last-child { margin-bottom: 0; }
.nav-label {
  font-size: 13px;
  color: var(--muted);
  min-width: 80px;
}
.btn-nav {
  font-size: 13px;
  padding: 8px 12px;
}
.instrucoes-list { margin-top: 8px; }
.instrucoes-step { font-size: 13px; margin: 6px 0; color: var(--text); }
.instrucoes-num { font-weight: 700; margin-right: 6px; color: var(--primary); }
.guia-banner {
  background: var(--card-bg, #f8f9fa);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.guia-banner-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.guia-banner-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guia-voice-toggle { font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.guia-view-toggle { display: inline-flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.guia-view-btn {
  font-size: 12px; padding: 6px 10px; border: none; background: var(--card-bg); color: var(--muted); cursor: pointer;
}
.guia-view-btn.active { background: var(--primary, #2563eb); color: #fff; font-weight: 600; }
.guia-btn-recalcular {
  font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--primary, #2563eb);
  background: transparent; color: var(--primary, #2563eb); cursor: pointer; font-weight: 600;
}
.guia-btn-recalcular:hover:not(:disabled) { background: var(--primary, #2563eb); color: #fff; }
.guia-btn-recalcular:disabled { opacity: 0.7; cursor: not-allowed; }
.guia-btn-recalcular.loading { opacity: 0.8; pointer-events: none; }
.guia-banner-text.guia-recalculando { color: var(--primary, #2563eb); }
.guia-banner-text.guia-fora-rota { color: var(--danger, #dc2626); }
.nav-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 0;
}
.mb-16 { margin-bottom: 16px; }

.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-small { font-size: 13px; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* =========================
   RESPONSIVO
   ========================= */
@media (min-width: 600px) {
  .container {
    padding: 24px 24px 92px;
  }
}

/* =========================
   ACESSIBILIDADE
   ========================= */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Remove o highlight azul no touch em iOS */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Melhor legibilidade em telas pequenas */
@media (max-width: 360px) {
  body { font-size: 14px; }
  .oferta-title { font-size: 16px; }
  .oferta-preco { font-size: 22px; }
}

/* =========================
   AVISOS IN-APP
   ========================= */
.h1 { font-size: 1.25rem; font-weight: 800; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.topbar-avisos-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--danger);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avisos-toasts {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
  pointer-events: none;
}
.avisos-toasts .avisos-toast {
  pointer-events: auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 12px 14px;
  border-left: 4px solid var(--primary);
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.avisos-toasts .avisos-toast.avisos-toast--success { border-left-color: var(--success); }
.avisos-toasts .avisos-toast.avisos-toast--info { border-left-color: var(--info); }
.avisos-toasts .avisos-toast.avisos-toast--warning { border-left-color: var(--warning); }
.avisos-toasts .avisos-toast.avisos-toast--default { border-left-color: var(--muted); }
.avisos-toasts .avisos-toast.avisos-toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.avisos-toasts .avisos-toast.avisos-toast-dismissing {
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.avisos-toasts .avisos-toast.swiping {
  transition: none;
}
.avisos-toast-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.avisos-toast-body { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.avisos-toast-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.avisos-toast--success .avisos-toast-link { color: var(--success); }
.avisos-toast--info .avisos-toast-link { color: var(--info); }
.avisos-toast--warning .avisos-toast-link { color: var(--warning); }
.avisos-page-actions { margin-bottom: 12px; }
.avisos-item-unread { border-left: 3px solid var(--primary); margin-left: -14px; padding-left: 11px; }
/* Dropdown do sininho - bordas suaves; texto sempre legível (não herda branco do header) */
.avisos-dropdown-wrap {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 999;
  width: min(320px, calc(100vw - 24px));
  max-height: 70vh;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.avisos-dropdown-wrap .avisos-dropdown-header {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--bg);
  color: var(--text);
}
.avisos-dropdown-wrap .avisos-dropdown-list { overflow: auto; max-height: 50vh; }
.avisos-dropdown-wrap .avisos-dropdown-item {
  display: block;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
  width: 100%;
  font: inherit;
  color: var(--text);
  background: none;
  box-sizing: border-box;
  outline: none;
}
.avisos-dropdown-wrap .avisos-dropdown-item:last-of-type { border-bottom: none; }
.avisos-dropdown-wrap .avisos-dropdown-item:hover { background: var(--primary-light); }
.avisos-dropdown-wrap .avisos-dropdown-item:focus { outline: none; }
.avisos-dropdown-wrap .avisos-dropdown-item-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; color: var(--text); }
.avisos-dropdown-wrap .avisos-dropdown-item-body { font-size: 13px; color: var(--muted); }
.avisos-dropdown-wrap .avisos-dropdown-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.avisos-dropdown-wrap .btn-marcar-todos {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
}
.avisos-dropdown-wrap .avisos-dropdown-ver-todos { font-size: 13px; color: var(--muted); text-align: center; display: block; padding: 4px 0; }
[data-theme="dark"] .avisos-dropdown-wrap {
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
[data-theme="dark"] .avisos-dropdown-wrap .avisos-dropdown-header,
[data-theme="dark"] .avisos-dropdown-wrap .avisos-dropdown-item,
[data-theme="dark"] .avisos-dropdown-wrap .avisos-dropdown-footer {
  border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .avisos-dropdown-wrap .avisos-dropdown-item:hover {
  background: rgba(255,255,255,0.06);
}
.avisos-list { padding: 0; }
.avisos-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}
.avisos-item:last-child { border-bottom: none; }
.avisos-item:hover { background: var(--primary-light); }
.avisos-item-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.avisos-item-body { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.avisos-item-date { font-size: 12px; color: var(--muted); }
