/* =========================================================
   Talhão Cliente — app.css — base compartilhada por TODAS as
   telas do app do cliente (login à parte, que tem seu próprio
   <style> em index.html, mas usa as mesmas variáveis daqui):
   variáveis de cor/fonte, reset, topo (app-topbar), menu lateral
   (app-sidebar), cartões, botões, modais/folhas, pílulas de
   status, toast e os poucos componentes usados em mais de uma
   tela (resumo em "hero", plano do veículo, abas de veículo,
   trajetos, faturas). O que é específico de UMA tela só fica no
   CSS dela (css/mapa.css, css/cercas.css).

   Mobile-first: todo o layout parte do celular; os breakpoints no
   fim do arquivo (a partir de 640px) só limitam a largura e dão
   mais respiro em tablets/telas maiores — o app nunca vira um
   "site de desktop", continua com cara de app em qualquer tamanho.
   ========================================================= */

:root {
  --bg: #FFFFFF;
  --surface: #F2F5FC;
  --surface-hi: #E7EDFB;
  --border: #D6E0F5;
  --border-soft: #E4EAF8;
  --text: #10162B;
  --text-dim: #545F80;
  --text-faint: #93A0C2;

  --primary: #2E5CF6;
  --primary-hi: #1A46E0;
  --primary-dim: #7C97F7;
  --primary-soft: #E7ECFE;

  --rust: #FF5A2E;
  --rust-hi: #E7440F;
  --rust-soft: #FFE4DA;

  --ok: #17A34A;
  --ok-soft: #DCF3E4;
  --alert: #E63946;
  --alert-soft: #FBDEE1;

  /* Mesmo tom de azul da barra de título do painel administrativo
     (css/layout.css lá) — deixa a barra superior do app do cliente
     com a mesma identidade visual. */
  --topbar-from: #101B4D;
  --topbar-to: #070C29;

  /* Uma família só pro app inteiro (Inter) — títulos usam peso
     maior em vez de trocar de fonte, pra tudo ficar visualmente
     consistente. --font-display é mantido (mesmo valor de
     --font-body) só pra não precisar reescrever cada regra que já
     usava var(--font-display); IBM Plex Mono continua à parte, só
     pro que é literalmente monoespaçado (placa, código Pix). */
  --font-display: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --topbar-h: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* Trava o scroll do fundo enquanto o menu lateral ou a barra de
   veículos (mapa.html) está aberta — ver initSidebar em js/app.js. */
body.sidebar-locked { overflow: hidden; }

/* ---------------------------------------------------------
   Casca do app — topo fixo + conteúdo rolável.
   --------------------------------------------------------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* Mesmo azul (e o mesmo gradiente) da barra de título do painel
   administrativo — sem a "logo" T aqui (fica só no topo do menu
   lateral, .sidebar-head), a barra superior mostra só o botão de
   menu e o nome da tela, com ícones/texto em branco por cima do
   fundo escuro. */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: calc(var(--safe-top)) 14px 0;
  background: linear-gradient(120deg, var(--topbar-from) 0%, var(--topbar-to) 100%);
  box-shadow: 0 4px 18px -8px rgba(7, 12, 41, 0.5);
  flex-shrink: 0;
}

.app-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.app-menu-btn svg { width: 19px; height: 19px; }
.app-menu-btn:active { background: rgba(255, 255, 255, 0.24); transform: scale(0.93); }

.app-topbar-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
/* Fica só no cabeçalho do menu lateral agora — a barra de título
   superior não tem mais logo, só o nome da tela. */
.sidebar-head .app-topbar-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--topbar-from), var(--topbar-to));
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Barra de título superior mostra o NOME DA TELA (fixo em cada
   página) — o nome do cliente não aparece mais aqui, só no topo
   do menu lateral (.sidebar-client). Texto branco por cima do
   fundo azul escuro. */
.app-topbar-title {
  font-weight: 700;
  font-size: 15.5px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------------------------------------------------------
   Conteúdo — rolável, com respiro; app-content-flush tira o
   respiro (usada pela tela de Mapa, que ocupa a tela toda).
   --------------------------------------------------------- */
.app-content {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px calc(24px + var(--safe-bottom));
}
.app-content-flush { max-width: none; padding: 0; margin: 0; }

.screen-head { margin-bottom: 16px; }
.screen-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--text); }
.screen-head p { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }

.screen-fab-row { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.screen-fab-row .btn-primary { padding: 10px 16px; font-size: 12.5px; }

/* ---------------------------------------------------------
   Menu lateral (sidebar) — desliza da esquerda; a barra de
   veículos do mapa (id="vehicleDrawer") reaproveita a mesma base
   com a classe .from-right pra deslizar da direita.
   --------------------------------------------------------- */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(10, 16, 40, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sidebar-scrim.open { opacity: 1; pointer-events: auto; }

/* Em celular o menu preenche a tela toda (100%) — só a partir do
   breakpoint de tablet/desktop (ver media query no fim do arquivo)
   é que volta a ser uma faixa lateral estreita, no estilo "drawer"
   de app maior. */
.app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 31;
  width: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  box-shadow: 0 0 40px -12px rgba(10, 16, 40, 0.4);
  padding-top: var(--safe-top);
}
.app-sidebar.open { transform: translateX(0); }
.app-sidebar.from-right { left: auto; right: 0; transform: translateX(100%); }
.app-sidebar.from-right.open { transform: translateX(0); }

.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid var(--border-soft); }
.sidebar-head-text { min-width: 0; flex: 1; }
.sidebar-brand { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text); }
.sidebar-client { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-close {
  width: 32px; height: 32px; border-radius: 9px; border: none; background: transparent;
  color: var(--text-faint); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}
.sidebar-close svg { width: 17px; height: 17px; }
.sidebar-close:active { background: var(--surface); transform: scale(0.9); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; flex: 1; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: background 0.15s ease, transform 0.12s ease;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:active { background: var(--surface); transform: scale(0.98); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary-hi); font-weight: 600; }

/* Botão de sair — vive no menu lateral (não mais na barra
   superior). Fica logo abaixo da navegação, com sua própria borda
   pra se separar visualmente dos links de tela. */
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-top: 1px solid var(--border-soft);
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--alert);
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}
.sidebar-logout svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-logout { transition: background 0.15s ease, transform 0.12s ease; }
.sidebar-logout:active { background: var(--alert-soft); transform: scale(0.98); }

.sidebar-foot { padding: 14px 16px calc(14px + var(--safe-bottom)); font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border-soft); }

/* ---------------------------------------------------------
   Cartões, estado vazio, texto monoespaçado
   --------------------------------------------------------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 10px 24px -18px rgba(16, 22, 43, 0.35);
}

.empty-state {
  text-align: center;
  padding: 34px 18px;
  font-size: 12.5px;
  color: var(--text-faint);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------
   Botões — cara de app nativo: cantos bem arredondados (mesmo
   "continuous corner" do iOS/Android), sem toque azulado de link,
   e feedback de toque de verdade (encolhe + escurece um pouco no
   :active, em vez de só um "translateY" sutil) — a pessoa sente
   que apertou, como num botão nativo em vez de um botão de site.
   --------------------------------------------------------- */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  border-radius: 13px;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.12s cubic-bezier(.34,1.4,.64,1), filter 0.15s ease, background 0.15s ease, box-shadow 0.12s ease;
  white-space: nowrap;
}
.btn-primary svg, .btn-secondary svg, .btn-danger svg { flex-shrink: 0; }
.btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: scale(0.96); }
.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hi) 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 10px 20px -10px rgba(46, 92, 246, 0.55);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { filter: brightness(0.95); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 4px 10px -6px rgba(46, 92, 246, 0.5); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hi); }
.btn-secondary:active { background: var(--surface-hi); border-color: var(--primary-dim); }

.btn-danger {
  background: var(--alert-soft);
  color: var(--rust-hi);
}
.btn-danger:hover { filter: brightness(0.97); }
.btn-danger:active { filter: brightness(0.93); }

.btn-block { width: 100%; }

.icon-chip { display: inline-flex; align-items: center; justify-content: center; }
.icon-chip svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------
   Pílulas de status
   --------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: lowercase;
  white-space: nowrap;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.moving { background: var(--rust-soft); color: var(--rust-hi); }
.status-pill.idle { background: var(--ok-soft); color: var(--ok); }
.status-pill.offline { background: var(--surface-hi); color: var(--text-faint); }
.status-pill.blocked-pill { background: var(--alert-soft); color: var(--alert); }
.status-pill.active-pill { background: var(--ok-soft); color: var(--ok); }

/* botão de alerta de velocidade ligado/pausado reaproveita
   .status-pill, mas como <button> (cursor + sem sombra herdada) */
button.status-pill { border: none; cursor: pointer; }

/* ---------------------------------------------------------
   Modais / folhas (bottom sheets)
   --------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 16, 40, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  transform: translateY(16px);
  transition: transform 0.22s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-sheet-grip { width: 36px; height: 4px; border-radius: 100px; background: var(--border); margin: 4px auto 14px; }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--text); }
.modal-head p { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.4; }

.modal-close {
  width: 30px; height: 30px; border-radius: 9px; border: none; background: var(--surface);
  color: var(--text-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}
.modal-close svg { width: 15px; height: 15px; }
.modal-close:active { background: var(--surface-hi); transform: scale(0.9); }

.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

#formFence, #formAlert { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.form-field input, .form-field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14.5px;
  color: var(--text);
}
.form-field input:focus, .form-field select:focus {
  outline: none; border-color: var(--primary); background: var(--bg); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-field .hint { font-size: 11px; color: var(--text-faint); line-height: 1.4; }

/* ---------------------------------------------------------
   Confirmação modal genérica (ver ensureConfirmModal em js/app.js)
   --------------------------------------------------------- */
.modal-confirm {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border-radius: 18px;
  padding: 22px 22px calc(20px + var(--safe-bottom));
  text-align: center;
}
.confirm-overlay .modal-confirm { margin: auto; }
.confirm-icon {
  width: 46px; height: 46px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--primary-soft); color: var(--primary-hi);
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-overlay.is-danger .confirm-icon { background: var(--alert-soft); color: var(--alert); }
.modal-confirm h2 { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; margin-bottom: 8px; }
.modal-confirm p { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin-bottom: 20px; }
.confirm-actions { display: flex; flex-direction: column-reverse; gap: 8px; }

/* ---------------------------------------------------------
   Toast
   --------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 60;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  background: var(--text);
  color: #fff;
  border-radius: 100px;
  padding: 11px 18px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 16px 34px -14px rgba(10, 16, 40, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 15px; height: 15px; color: var(--ok); flex-shrink: 0; }

/* ---------------------------------------------------------
   Resumo em "hero" — reaproveitado por Veículos (fleetHero) e
   Faturas (faturaSummary): faixa com números lado a lado.
   --------------------------------------------------------- */
.fleet-hero, .fatura-hero {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 10px;
  margin-bottom: 14px;
  box-shadow: 0 10px 24px -18px rgba(16, 22, 43, 0.35);
}
.fleet-hero-item, .fatura-hero-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  min-width: 0;
}
.fleet-hero-item .label, .fatura-hero-item .label { font-size: 10.5px; color: var(--text-faint); font-weight: 600; }
.fleet-hero-item .value, .fatura-hero-item .value {
  font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--text); white-space: nowrap;
}
.fatura-hero-item .value.alert { color: var(--alert); }
.fleet-hero-divider, .fatura-hero-divider { width: 1px; align-self: stretch; background: var(--border-soft); margin: 2px 4px; }

/* ---------------------------------------------------------
   Plano do veículo — linha usada no cartão de veículo
   --------------------------------------------------------- */
.vehicle-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.vehicle-plan-row .plan-name { color: var(--primary-hi); font-weight: 600; }
.vehicle-plan-row .plan-price { color: var(--primary-hi); font-weight: 600; }

.vehicle-card-actions.two-col { display: flex; gap: 8px; }
.vehicle-card-actions.two-col > * { flex: 1; }
.vehicle-card-block { margin-top: 2px; }
.vehicle-card-block button { width: 100%; }

/* ---------------------------------------------------------
   Faturas — lista de cobranças
   --------------------------------------------------------- */
.invoice-list, .fence-list, .alert-list, .vehicle-list, .trip-list { display: flex; flex-direction: column; gap: 12px; }

.invoice-card {
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.invoice-card-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-hi); color: var(--text-faint);
}
.invoice-card-icon svg { width: 18px; height: 18px; }
.invoice-card.is-paid .invoice-card-icon { background: var(--ok-soft); color: var(--ok); }
.invoice-card.is-pending .invoice-card-icon { background: var(--primary-soft); color: var(--primary-hi); }
.invoice-card.is-overdue .invoice-card-icon { background: var(--alert-soft); color: var(--alert); }

.invoice-card-main { flex: 1; min-width: 0; }
.invoice-card-title { font-weight: 600; font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invoice-card-due { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.invoice-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.invoice-card-value { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--text); }
.invoice-pay-btn { padding: 7px 12px; font-size: 11.5px; }

/* ---------------------------------------------------------
   Folha de pagamento Pix (faturas.html)
   --------------------------------------------------------- */
.pix-summary { text-align: center; margin-bottom: 18px; }
.pix-summary .pix-ref { font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
.pix-summary .pix-val { font-family: var(--font-display); font-weight: 600; font-size: 26px; color: var(--text); }

.pix-code-row { display: flex; gap: 8px; margin-bottom: 16px; }
.pix-code-row input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}
.pix-code-row .btn-secondary { flex-shrink: 0; padding: 0 16px; }
.pix-code-row .btn-secondary.copied { color: var(--ok); border-color: var(--ok-soft); background: var(--ok-soft); }

.pix-hint {
  display: flex;
  gap: 9px;
  background: var(--surface);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.45;
  margin-bottom: 18px;
}
.pix-hint svg { width: 15px; height: 15px; color: var(--text-faint); flex-shrink: 0; margin-top: 1px; }

/* ---------------------------------------------------------
   Relatórios — abas de veículo, resumo do dia, lista de trajetos
   --------------------------------------------------------- */
.vehicle-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; -ms-overflow-style: none; scrollbar-width: none; }
.vehicle-tabs::-webkit-scrollbar { display: none; }
.vehicle-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 100px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}
.vehicle-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.vehicle-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.report-date-row { margin-bottom: 14px; }
.report-date-row input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--text);
}

.report-summary {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 8px;
  margin-bottom: 16px;
  box-shadow: 0 10px 24px -18px rgba(16, 22, 43, 0.35);
}
.report-summary-item { flex: 1; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.report-summary-item .label { font-size: 10.5px; color: var(--text-faint); font-weight: 600; }
.report-summary-item .value { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--text); }
.report-summary-divider { width: 1px; align-self: stretch; background: var(--border-soft); margin: 2px 4px; }

.trip-card { padding: 14px; }
.trip-card-top { display: flex; align-items: center; gap: 12px; }
.trip-card-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-hi);
  display: flex; align-items: center; justify-content: center;
}
.trip-card-icon svg { width: 16px; height: 16px; }
.trip-card.has-alert .trip-card-icon { background: var(--alert-soft); color: var(--alert); }
.trip-card-info { flex: 1; min-width: 0; }
.trip-card-time { font-weight: 600; font-size: 13.5px; color: var(--text); }
.trip-card-duration { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }
.trip-card-distance { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text); flex-shrink: 0; }

.speed-bar { height: 5px; border-radius: 100px; background: var(--surface-hi); margin: 12px 0 10px; overflow: hidden; }
.speed-bar-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--ok), var(--rust)); }

.trip-card-stats { display: flex; gap: 18px; }
.trip-stat { display: flex; flex-direction: column; gap: 2px; }
.trip-stat .label { font-size: 10px; color: var(--text-faint); font-weight: 600; }
.trip-stat .value { font-size: 13px; font-weight: 600; color: var(--text); }
.trip-stat.is-max .value { color: var(--rust-hi); }

.trip-alert-note {
  display: flex; align-items: flex-start; gap: 7px;
  background: var(--alert-soft); color: var(--alert);
  border-radius: 8px; padding: 8px 10px; margin-top: 10px;
  font-size: 11.5px; line-height: 1.4;
}
.trip-alert-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.trip-card-route-link {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--primary-hi);
}

/* ---------------------------------------------------------
   Alternador (switch) — usado nas configurações de notificação
   (relatorios.html): mesmo cartão de "Alertas por notificação".
   --------------------------------------------------------- */
.settings-card { padding: 14px; margin-bottom: 16px; }
.settings-row { display: flex; align-items: center; gap: 12px; }
.settings-row-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary-hi);
  display: flex; align-items: center; justify-content: center;
}
.settings-row-icon svg { width: 17px; height: 17px; }
.settings-row-text { flex: 1; min-width: 0; }
.settings-row-text .title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.settings-row-text .desc { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 100px;
  cursor: pointer; transition: background 0.15s ease;
}
.switch .track::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s ease;
  box-shadow: 0 2px 6px -1px rgba(16,22,43,0.35);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(18px); }

.settings-card-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.settings-card-foot .btn-secondary { width: 100%; font-size: 12px; padding: 9px; }

/* ---------------------------------------------------------
   Responsivo — telas maiores que celular (tablet/desktop): o
   conteúdo continua com cara de app, só ganha mais respiro e um
   teto de largura confortável pra leitura.
   --------------------------------------------------------- */
@media (min-width: 640px) {
  body { background: var(--surface-hi); }
  .app-content { padding: 24px 20px calc(32px + var(--safe-bottom)); }
  .app-topbar { padding-left: 20px; padding-right: 20px; }
  /* Só a partir daqui o menu volta a ser uma faixa lateral estreita
     — em celular (regra base, acima) ele preenche a tela toda. */
  .app-sidebar { width: min(82vw, 320px); }
}

@media (min-width: 860px) {
  .app-content { max-width: 720px; }
}

/* ---------------------------------------------------------
   Modal de "nova versão disponível" (ver js/update-modal.js) —
   visual próprio (fundo desfocado + entrada com leve "salto"),
   fica por cima até de outros modais/folhas (z-index maior),
   já que não deve ser possível continuar usando uma tela
   desatualizada por engano.
   --------------------------------------------------------- */
.update-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 12, 41, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.update-modal-overlay.open { opacity: 1; pointer-events: auto; }

.update-modal {
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border-radius: 22px;
  padding: 28px 24px calc(22px + var(--safe-bottom));
  text-align: center;
  box-shadow: 0 30px 70px -20px rgba(7, 12, 41, 0.55);
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  transition: transform 0.26s cubic-bezier(.2,.9,.3,1.3), opacity 0.22s ease;
}
.update-modal-overlay.open .update-modal { transform: translateY(0) scale(1); opacity: 1; }

.update-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--topbar-from), var(--topbar-to));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 26px -10px rgba(16, 27, 77, 0.6);
}
.update-modal-icon svg { width: 26px; height: 26px; }

.update-modal h2 { font-family: var(--font-display); font-weight: 700; font-size: 17.5px; color: var(--text); margin-bottom: 8px; }
.update-modal p { font-size: 13px; color: var(--text-dim); line-height: 1.55; margin-bottom: 22px; }

.update-modal-actions { display: flex; flex-direction: column; gap: 10px; }
.update-modal-later {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.update-modal-later:active { color: var(--text-dim); }
