/* Botões */
.btn[hidden] {
  display: none;
}

/* Selos de ícone coloridos (genéricos) + cabeçalho de seção com ícone.
   Usados na tela de Perfil pra dar orientação visual às seções. */
.icon-container.icon-blue { background: var(--blue-soft); color: var(--blue); }
.icon-container.icon-green { background: var(--green-bg); color: var(--green); }
.icon-container.icon-red { background: var(--red-bg); color: var(--red); }
.icon-container.icon-orange { background: var(--orange-bg); color: var(--orange); }
.icon-container.icon-muted { background: var(--gray); color: var(--muted); }

.section-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.section-head .icon-container {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.section-head h2 { margin: 0; }

/* Same specificity-tiebreak gotcha as .btn[hidden] above: any class that sets
   `display` needs its own [hidden] override, since a class selector beats the
   UA stylesheet's [hidden] rule on the cascade tiebreak. */
.modal-overlay[hidden] {
  display: none;
}

.app-header[hidden] {
  display: none;
}

.no-route-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 24px;
}

.no-route-row[hidden] {
  display: none;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-frame);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
}

.auth-logo {
  display: block;
  width: 132px;
  height: auto;
  margin: 0 auto 18px;
}

.auth-tagline {
  text-align: center;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 var(--space-5);
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 4px;
  color: var(--ink);
}

.auth-card .subtitle {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  margin: 0 0 var(--space-6);
}

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  /* 16px evita o auto-zoom do iOS Safari ao focar o campo (ele amplia quando
     a fonte é < 16px) e melhora a legibilidade. */
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* iOS Safari renderiza <input type="date"> com o controle nativo do
   sistema, que ignora width:100%/box-sizing e pode desenhar mais largo que
   o container (estourando pra fora do card). -webkit-appearance:none força
   o Safari a tratar como um input normal, respeitando nossa caixa. */
.field input[type="date"] {
  padding-right: 8px;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  /* right:2px + 44px de largura mantém o ícone (20px, centralizado) no mesmo
     ponto visual do antigo box 28px @ right:10px, mas com alvo de toque 44x44. */
  right: 2px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ink);
}

.field input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.field-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
  min-height: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-btn);
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-blue);
  color: var(--white);
  box-shadow: var(--shadow-btn-blue);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Compact pill CTA (e.g. "Iniciar rota") — flat solid blue, icon + bold label,
   matches the reference design's toolbar button instead of the app's usual
   full-width hero .btn-primary. */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: var(--white);
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(23, 71, 255, 0.24);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-cta:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Period segmented control (Hoje/Semana/Mês) */
.seg {
  display: inline-flex;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}

.seg button {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.seg button.on {
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
}

.auth-links {
  margin-top: var(--space-5);
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
}

.auth-links a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  z-index: 1000;
}

.toast.toast-error {
  background: var(--red);
}

.toast.toast-success {
  background: var(--green);
}

/* App shell (authenticated pages) */
.app-page {
  min-height: 100vh;
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--space-6) + env(safe-area-inset-top)) var(--space-4) 80px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.app-header a {
  color: var(--blue);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header-user .avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
  border-radius: 11px;
  flex-shrink: 0;
}

.app-header-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.app-header-brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.app-header-brand b {
  color: var(--ink);
  font-weight: 800;
}

.btn-inline {
  width: auto;
  padding: 9px 16px;
  font-size: 13px;
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--gray);
}

.btn-add-income,
.btn-add-expense {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  width: 100%;
  gap: 5px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: none;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-add-income svg,
.btn-add-expense svg {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
}

.btn-add-income:active,
.btn-add-expense:active {
  transform: scale(0.97);
}

.btn-add-income {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
}

.btn-add-income:hover {
  background: var(--green);
  color: var(--white);
}

.btn-add-expense {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-add-expense:hover {
  background: var(--red);
  color: var(--white);
}

.btn-danger-text {
  background: transparent;
  color: var(--red);
  border: none;
  box-shadow: none;
  width: auto;
  padding: 6px 8px;
  font-size: 12.5px;
}

.btn-text {
  background: transparent;
  color: var(--blue);
  border: none;
  box-shadow: none;
  width: auto;
  padding: 6px 8px;
  font-size: 12.5px;
}

.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
}

.field select:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 72px;
}

.field textarea:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.field-color-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.field-color-row input[type='color'] {
  width: 44px;
  height: 40px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

/* .field label sets display:block with higher specificity than the rule
   above whenever field-checkbox is on the <label> itself (instead of on
   the wrapping .field div) — pin it back to flex here. */
.field label.field-checkbox {
  display: flex;
}

.field input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
}

/* Interruptor liga/desliga (switch) — usado no controle de quilometragem
   por veículo. O input real fica escondido; o "trilho" e a "bolinha" são
   desenhados por CSS. */
.switch-field {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  background: var(--gray);
}
/* Precisa vencer `.field label { display:block }` por especificidade — mesmo
   motivo do .field-checkbox logo acima. */
.field label.switch-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.switch-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
.switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
}
.switch input[type="checkbox"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 999px;
  transition: background var(--transition-fast);
}
.switch-track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-fast);
}
.switch input:checked + .switch-track {
  background: var(--blue);
}
.switch input:checked + .switch-track::before {
  transform: translateX(18px);
}

.field-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4) var(--space-3);
}

/* <p> tem margem padrão do navegador que soma com o gap do grid, deixando
   linhas de resumo (Início/Fim/Tempo total/etc.) longe demais uma da
   outra — zera aqui pra sobrar só o gap controlado. */
.field-grid-2 > p {
  margin: 0;
}

/* Sem isso, um item de grid nunca encolhe abaixo da largura "natural" do
   conteúdo (min-width:auto é o padrão) — em iOS, <input type="date"> tem
   uma largura mínima própria maior que a coluna, e o campo vaza pra fora
   do card mesmo com width:100%. */
.field-grid-2 > .field {
  min-width: 0;
}

.field-grid-2 > .field input {
  min-width: 0;
}

/* Celulares em geral (cobre a maioria dos iPhones, ~390-430px) — os dois
   campos ficam apertados demais lado a lado, principalmente
   <input type="date"> com o seletor nativo do navegador — empilha em
   uma coluna só. Acima de 480px (tablets/desktop) volta a duas colunas. */
@media (max-width: 480px) {
  .field-grid-2 {
    grid-template-columns: 1fr;
  }
}

.company-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.company-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  flex-wrap: wrap;
}

.company-color-dot {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-avatar);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  line-height: 1;
}

.company-info {
  flex: 1;
  min-width: 0;
}

.company-info .name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.company-info .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.company-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
}

.delivery-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}

#delivery-list {
  max-height: 132px;
  overflow-y: auto;
}

.delivery-item:last-child {
  border-bottom: none;
}

.delivery-item .info {
  flex: 1;
  min-width: 0;
}

.delivery-item .info .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.delivery-item .info .meta {
  font-size: 11px;
  color: var(--muted);
}

.delivery-item .value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

/* Valor de cada entrega na conferência = botão de editar (pílula com lápis),
   deixa claro que dá pra tocar e mudar o valor daquela entrega. */
.value-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.value-edit-btn .pencil {
  color: var(--blue);
}
.value-edit-btn:hover {
  background: var(--blue-soft);
  border-color: var(--blue-light);
}
.value-edit-btn:active {
  background: var(--gray);
}

/* Route card (gradient, active/paused) */
.route-card {
  padding: 24px;
  border-radius: 18px;
  background: var(--gradient-blue);
  box-shadow: var(--shadow-btn-blue);
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.route-card.is-paused {
  background: linear-gradient(150deg, #f07272, #e14b4b 45%, #c23838);
  box-shadow: 0 10px 22px -8px rgba(225, 75, 75, 0.55);
}

.route-card-chip {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.route-card-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--white);
  animation: route-dot-pulse 1.6s infinite;
}

@keyframes route-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.route-card-timer {
  color: var(--white);
  margin: 10px 0 4px;
}

.route-card-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 11.5px;
  font-weight: 500;
}

.btn-route-primary {
  background: var(--white);
  color: var(--blue);
  box-shadow: none;
}

.btn-route-secondary {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.route-card-inner-panel {
  background: var(--white);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  color: var(--ink);
}

.route-card-inner-panel .text-label {
  color: var(--muted);
}

/* ===== Painel de rota — modo transportadora (pacotes) ===== */
.package-panel-counter {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: center;
  color: var(--ink);
}

.package-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.package-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--gray);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.package-info-item .emoji {
  font-size: 15px;
  line-height: 1;
}

.package-eta {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.avatar-lg {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  font-size: 28px;
  background: linear-gradient(150deg, #3b3f4a, #111111);
  box-shadow: 0 10px 26px -12px rgba(17, 17, 17, 0.45);
}

.danger-zone {
  border: 1px solid rgba(225, 75, 75, 0.3);
  background: var(--red-bg);
  border-radius: var(--radius-card);
  padding: 18px;
}

.danger-zone .text-card-title {
  color: var(--red);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
}

.modal-card {
  background: var(--white);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  /* Impede o scroll de "vazar" pra página de fundo ao chegar no fim do popup. */
  overscroll-behavior: contain;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

@media (min-width: 640px) {
  .modal-card {
    border-radius: var(--radius-frame);
  }
}

.modal-card .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Alvo de toque 44x44; margens negativas puxam o box pra dentro do padding do
     card, mantendo o X no canto e sem aumentar a altura do cabeçalho. */
  width: 44px;
  height: 44px;
  margin: -10px -10px -10px 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

/* Plan sheet — bottom sheet forçado (não centralizado como .modal-card),
   sobe até 70% da altura da tela, com X de fechar no canto superior direito */
.plan-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.45);
  z-index: 1000;
}

.plan-sheet-overlay[hidden] {
  display: none;
}

.plan-sheet-card {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--white);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-card);
  animation: plan-sheet-slide-up 0.25s ease;
}

@keyframes plan-sheet-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.plan-sheet-close-btn {
  position: absolute;
  /* top/right:8px + 44px mantém o ícone no mesmo ponto visual do antigo
     box @14px, com alvo de toque 44x44. */
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 0;
}

.plan-sheet-close-btn:hover {
  color: var(--ink);
}

/* Platform sessions (inside active route card) */
.platform-sessions-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.platform-session-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.platform-session-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.platform-session-card .head .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.platform-session-card .gross {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}

.platform-session-card .progress-track {
  margin-bottom: 8px;
}

.platform-session-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.platform-session-quick-actions button {
  width: auto;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 8px;
  background: var(--gray);
  color: var(--ink);
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.platform-session-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.platform-session-fields label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 3px;
}

.platform-session-fields label.value-positive {
  color: var(--green);
}

.platform-session-fields label.value-negative {
  color: var(--red);
}

.platform-session-fields input {
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-family: inherit;
}

#quick-delivery-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 84px;
  gap: 8px;
  max-height: calc(84px * 2 + 8px);
  overflow-y: auto;
}

.quick-delivery-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  border-radius: 14px;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  font-family: inherit;
  color: var(--white);
}

.quick-delivery-tile .name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quick-delivery-tile .default-value {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
}

.quick-delivery-tile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quick-delivery-tile:active {
  transform: scale(0.96);
}

/* Ganhos / Despesas report pages */
.stats-grid {
  display: grid;
  /* minmax(0, 1fr) (em vez de 1fr) deixa as colunas encolherem de verdade —
     senão valores grandes esticam o card e estouram a largura da tela. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Células podem encolher pra não estourar a largura da tela. */
.stats-grid > *,
.field-grid-2 > * {
  min-width: 0;
}

.mid-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .mid-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 5px 0;
}

.legend-row .sw {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-row .lname {
  flex: 1;
  font-weight: 600;
  color: var(--ink);
}

.legend-row .lval {
  font-weight: 700;
  color: var(--ink);
  margin-right: 8px;
}

.legend-row .lpct {
  color: var(--muted-2);
  width: 34px;
  text-align: right;
}

.bud {
  margin-bottom: 12px;
}

.bud .l {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-bottom: 5px;
}

.bud .l b {
  color: var(--ink);
  font-weight: 600;
}

.receipt-item,
.expense-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}

.receipt-item:last-child,
.expense-item:last-child {
  border-bottom: none;
}

.receipt-item .info,
.expense-item .info {
  flex: 1;
  min-width: 140px;
}

.receipt-item .name,
.expense-item .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.receipt-item .meta,
.expense-item .meta {
  font-size: 11px;
  color: var(--muted);
}

.receipt-col {
  min-width: 80px;
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
}

/* Dashboard */
.metric-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.metric-card-head .icon-container {
  width: 26px;
  height: 26px;
  margin-bottom: 0;
}


.metric-card {
  padding: 16px;
}

.hourly-rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hourly-rate-tile {
  min-width: 0;
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 6px;
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.hourly-rate-tile .text-value-lg {
  margin-top: 5px;
  line-height: 1.1;
  letter-spacing: -0.3px;
}

/* O valor (R$ x,xx) nunca quebra no meio do número — fica sempre numa linha,
   com fonte que encolhe em telas estreitas pra caber inteiro. O "/h" vai
   numa linha própria abaixo, pra não competir por espaço com o número. */
.hourly-rate-tile .rate-value {
  display: block;
  white-space: nowrap;
  font-size: clamp(14px, 4.6vw, 19px);
  font-weight: 700;
}

.hourly-rate-tile .rate-unit {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 1px;
}

.hourly-rate-tile.is-best {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.hourly-rate-tile.is-best .text-value-lg {
  color: var(--blue);
}

#online-now-dot {
  animation: online-now-pulse 1.6s ease-in-out infinite;
}

@keyframes online-now-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.metric-card .icon-container {
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
}

.metric-card .icon-container.icon-red {
  background: var(--red-bg);
  color: var(--red);
}

.metric-card .value {
  margin-top: 4px;
}

.metric-card .value.negative {
  color: var(--red);
}

.metric-card .value.positive {
  color: var(--green);
}

.chart-card {
  padding: 20px;
  margin-top: 20px;
}

.chart-days {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.chart-days span {
  flex: 1;
  text-align: center;
}

/* ===== Resultado do dia (hero) ===== */
.result-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}

.result-hero-body {
  padding: 22px 20px 20px;
}

.result-money {
  font-size: clamp(34px, 8vw, 46px);
  line-height: 1.05;
  margin: 4px 0 10px;
  color: var(--green);
}

.result-split {
  display: flex;
  gap: 0;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}

.result-split > div {
  flex: 1;
}

.result-split-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--ink);
}

.result-split-value.negative {
  color: var(--red);
}

.result-meta {
  margin-top: 18px;
}

.result-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

/* ===== Generic card head/body (reference-style dashboard cards) ===== */
.card-hd {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-bd {
  padding: 18px 20px;
}

/* ===== Para onde foi o dinheiro ===== */
.expense-breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}

.expense-breakdown-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.expense-breakdown-item .k {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.expense-breakdown-item .pill {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--gray);
  flex-shrink: 0;
}

.expense-breakdown-item .v {
  font-weight: 600;
  color: var(--ink);
}

/* ===== KPI tiles (em breve) ===== */
.grid-kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kpi-tile {
  padding: 12px 8px;
  min-width: 0;
}

.kpi-tile .text-label {
  white-space: normal;
  line-height: 1.25;
}

.kpi-tile .text-value-lg {
  /* Escala com a largura pra caber valores grandes (ex: R$ 1.214,50) sem
     cortar com "..."; quebra a linha como último recurso, nunca trunca. */
  font-size: clamp(13px, 4.2vw, 18px);
  letter-spacing: -0.4px;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.kpi-tile .text-caption {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .grid-kpi {
    gap: 10px;
  }

  .kpi-tile {
    padding: 14px 12px;
  }

  .kpi-tile .text-value-lg {
    font-size: 22px;
  }
}

/* ===== Bar chart (Quanto sobrou por dia) ===== */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding-top: 8px;
}

.bar-chart .bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  min-width: 0;
  cursor: pointer;
}

.bar-chart .bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.bar-chart .bar-value.neg {
  color: var(--red);
}

.bar-chart .bar-value.best {
  color: var(--blue);
}

.bar-chart .bar {
  width: 100%;
  background: var(--blue-soft);
  border-radius: 5px 5px 3px 3px;
  min-height: 4px;
}

.bar-chart .bar.neg {
  background: var(--red-bg);
}

.bar-chart .bar.best {
  background: var(--blue);
}

/* ===== Índice RotaPro gauge ===== */
.gauge-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Arco preenche suavemente até o valor do índice (offset setado no JS). */
#rotapro-index-arc {
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-wrap {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gauge-center {
  position: absolute;
  text-align: center;
}

.gauge-score {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.index-clickable {
  cursor: pointer;
  border-radius: 12px;
  margin: -6px;
  padding: 6px;
  transition: background 0.15s ease;
}

.index-clickable:hover,
.index-clickable:focus-visible {
  background: var(--gray);
  outline: none;
}

.index-delta {
  font-weight: 700;
}

.index-delta.positive {
  color: var(--green);
}

.index-delta.negative {
  color: var(--red);
}

.index-classification {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
}

.index-classification.alerta {
  color: var(--red);
  background: var(--red-bg);
}

.index-classification.precisa_melhorar {
  color: var(--orange);
  background: var(--orange-bg);
}

.index-classification.bom {
  color: var(--blue);
  background: var(--blue-soft);
}

.index-classification.excelente,
.index-classification.alta_performance {
  color: var(--green);
  background: var(--green-bg);
}

.index-pillars {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.index-pillar-row .index-pillar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}

.index-pillar-row .index-pillar-head .score {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
}

.index-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.index-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 10px 4px 8px;
}

/* ===== Índice RotaPro — modal de detalhe ===== */
.index-detail-hero {
  text-align: center;
  padding: 8px 0 20px;
}

.index-detail-score {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}

.index-detail-conclusion {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 14px 0 0;
}

.index-detail-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 20px 0 10px;
}

.index-highlight-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--gray);
  margin-bottom: 8px;
}

.index-highlight-card .icon {
  font-size: 18px;
  line-height: 1;
}

.index-highlight-card .title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
}

.index-highlight-card .message {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.index-indicators-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.index-indicator-tile {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.index-indicator-tile .value {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.index-indicator-tile .label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Minha moto ===== */
.moto-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13.5px;
}

.moto-status-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.company-participation-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}

.company-participation-item:last-child {
  border-bottom: none;
}

.company-participation-item .row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.company-participation-item .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
  flex-shrink: 0;
}

.company-participation-item .info {
  flex: 1;
  min-width: 0;
}

.company-participation-item .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.company-participation-item .meta {
  font-size: 11px;
  color: var(--muted);
}

.company-participation-item .value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.progress-track {
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
}

.movement-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}

.movement-item:last-child {
  border-bottom: none;
}

.movement-item .icon-container {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.movement-item .icon-container.icon-red {
  background: var(--red-bg);
  color: var(--red);
}

.movement-item .icon-container.icon-green {
  background: var(--green-bg);
  color: var(--green);
}

.movement-item .info {
  flex: 1;
  min-width: 0;
}

.movement-item .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.movement-item .time {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--gray);
  padding: 2px 7px;
  border-radius: var(--radius-chip);
  margin-top: 2px;
}

.movement-item .value {
  font-size: 13.5px;
  font-weight: 700;
  width: 90px;
  text-align: right;
}

.movement-item .value.entrada {
  color: var(--green);
}

.movement-item .value.saida {
  color: var(--red);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 900;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
}

.bottom-nav a.active {
  color: var(--blue);
}

.app-page.has-bottom-nav {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

/* Desktop sidebar */
.side {
  display: none;
}

@media (min-width: 768px) {
  .side {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    padding: 22px 10px;
    background: linear-gradient(180deg, #fcfdff, #f7f9fc);
    border-right: 1px solid var(--line);
    overflow-y: auto;
    z-index: 800;
  }

  .side .brand-word,
  .side .sec,
  .side .nav-label,
  .side .me-info {
    display: none;
  }

  .side .nav {
    justify-content: center;
  }

  .app-page {
    margin-left: 72px;
    max-width: none;
  }

  .bottom-nav {
    display: none;
  }
}

@media (min-width: 1280px) {
  .side {
    width: 236px;
    padding: 22px 16px;
    align-items: stretch;
  }

  .side .brand-word,
  .side .sec,
  .side .nav-label,
  .side .me-info {
    display: block;
  }

  .side .nav {
    justify-content: flex-start;
  }

  .app-page {
    margin-left: 236px;
    max-width: 900px;
    padding: 24px 32px 32px;
  }
}

.side .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.side .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--white);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.side .brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.side .brand-word {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--ink);
  white-space: nowrap;
}

.side .brand-word b {
  color: var(--blue);
  font-weight: 700;
}

.side .sec {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted-2);
  margin: 16px 6px 6px;
}

.side .nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9.5px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #5d6675;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 2px;
}

.side .nav svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.side .nav.active {
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 6px 14px -8px rgba(17, 17, 17, 0.1);
  color: var(--ink);
  font-weight: 600;
}

.side .nav.active svg {
  opacity: 1;
  color: var(--blue);
}

.side .nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side .me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
}

.side .me:hover {
  background: var(--white);
}

.side .me .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
  flex-shrink: 0;
}

.side .me-info .name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side .me-info .hint {
  font-size: 11px;
  color: var(--muted-2);
}

/* ===== Painel administrativo (/adm) ===== */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-frame);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
}

.admin-table tbody tr:hover {
  background: var(--gray);
}

.admin-table tbody tr[data-clickable] {
  cursor: pointer;
}

.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-filters select,
.admin-filters input[type='search'] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  background: var(--white);
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

/* "Como usar o app" accordion */
.howto-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--white);
}
.howto-item > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.howto-item > summary::-webkit-details-marker {
  display: none;
}
.howto-title {
  flex: 1;
  font-weight: 600;
}
.howto-caret {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.howto-item[open] > summary .howto-caret {
  transform: rotate(180deg);
}
.howto-item > p {
  padding: 0 14px 14px 48px;
}
