/* Central Motoboy — app unificado Inova + Formulativa
   Tema dinâmico: body.farm-inova → vermelho · body.farm-formul → azul
   Layout inspirado no motoboy.html original do InovaExpress.
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #F4F5F7; color: #111827; min-height: 100vh;
  overscroll-behavior-y: contain; -webkit-font-smoothing: antialiased;
}
body { font-size: 14px; padding-bottom: 80px; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; font-family: inherit; }
input, select, textarea { font: inherit; color: inherit; font-family: inherit; }
a { color: inherit; text-decoration: none; }

:root {
  --c-bg: #F4F5F7;
  --c-card: #FFFFFF;
  --c-border: #E5E7EB;
  --c-border-strong: #D1D5DB;
  --c-text: #111827;
  --c-text-2: #4B5563;
  --c-text-3: #9CA3AF;
  --c-success: #10B981;
  --c-success-light: #D1FAE5;
  --c-warn: #F59E0B;
  --c-warn-light: #FEF3C7;
  --c-danger: #EF4444;
  --c-danger-light: #FEE2E2;
  --c-info: #2563EB;
  --c-info-light: #DBEAFE;
  --c-purple: #8B5CF6;

  /* Cores Inova */
  --c-inova: #FF1F1F;
  --c-inova-dark: #C81414;
  --c-inova-light: #FFEBEB;
  /* Cores Formulativa */
  --c-formul: #1B5E9F;
  --c-formul-dark: #0E3F70;
  --c-formul-light: #DBEAFE;

  /* Tema ativo (vai sobrescrever via classe) */
  --t-main: var(--c-inova);
  --t-dark: var(--c-inova-dark);
  --t-light: var(--c-inova-light);
  --t-grad-from: #FF4747;
  --t-grad-mid:  #FF1F1F;
  --t-grad-to:   #C81414;
}
body.farm-inova {
  --t-main: var(--c-inova);
  --t-dark: var(--c-inova-dark);
  --t-light: var(--c-inova-light);
  --t-grad-from: #FF4747;
  --t-grad-mid:  #FF1F1F;
  --t-grad-to:   #C81414;
}
body.farm-formul {
  --t-main: var(--c-formul);
  --t-dark: var(--c-formul-dark);
  --t-light: var(--c-formul-light);
  --t-grad-from: #2563EB;
  --t-grad-mid:  #1B5E9F;
  --t-grad-to:   #0E3F70;
}

/* ============================
   LOGIN SPLIT 50/50
   ============================ */
.split-login {
  position: fixed; inset: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.split-side {
  position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.split-inova  { background: linear-gradient(135deg, #FF4747 0%, #C81414 70%, #8B0000 100%); }
.split-formul { background: linear-gradient(135deg, #2563EB 0%, #0E3F70 70%, #082A4D 100%); }
.split-side::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 1.5px, transparent 1.5px);
  background-size: 32px 32px;
  pointer-events: none;
}
.split-side::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 3px;
}
.split-inova::after { right: -1.5px; background: rgba(255,255,255,.25); }
.split-formul::after { left: -1.5px; background: rgba(255,255,255,.25); }
.split-content {
  text-align: center; color: #fff;
  padding: 32px 24px;
  position: relative; z-index: 2;
  max-width: 360px;
  animation: fadeUp .6s cubic-bezier(.22,1,.36,1) both;
}
.split-formul .split-content { animation-delay: .15s; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.split-logo {
  width: 110px; height: 110px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3), 0 0 0 5px rgba(255,255,255,.18);
  overflow: hidden;
  animation: logoFloat 4s ease-in-out infinite;
}
.split-formul .split-logo { animation-delay: 1s; }
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.split-logo img { max-width: 85%; max-height: 85%; object-fit: contain; }
.split-titulo {
  font-size: 26px; font-weight: 900; letter-spacing: -0.5px;
  margin-bottom: 4px; text-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.split-sub {
  font-size: 13px; font-weight: 600; opacity: .9;
  text-transform: uppercase; letter-spacing: 2px;
}
.split-line {
  width: 50px; height: 2px; background: rgba(255,255,255,.5);
  margin: 14px auto;
}
.split-desc { font-size: 13px; opacity: .85; line-height: 1.5; }

.login-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 10;
}
.login-card {
  width: 100%; max-width: 380px;
  background: #fff;
  border-radius: 24px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.5);
  animation: cardIn .5s cubic-bezier(.22,1,.36,1) .3s both;
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.login-header { text-align: center; margin-bottom: 20px; }
.login-bike {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--c-inova), var(--c-formul));
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 10px; font-size: 24px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2);
}
.login-titulo { font-size: 20px; font-weight: 900; color: var(--c-text); letter-spacing: -0.3px; }
.login-subtitulo {
  font-size: 12px; color: var(--c-text-2); font-weight: 600;
  margin-top: 2px; text-transform: uppercase; letter-spacing: 1px;
}
.login-field { margin-bottom: 12px; }
.login-field label {
  display: block; font-size: 11px; font-weight: 800; color: var(--c-text-2);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px;
}
.login-field input {
  width: 100%; padding: 13px 14px;
  background: #F9FAFB; border: 1.5px solid var(--c-border);
  border-radius: 10px; color: var(--c-text); font-size: 15px; font-weight: 600;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.login-field input:focus {
  outline: none; border-color: var(--c-inova); background: #fff;
  box-shadow: 0 0 0 3px rgba(255,31,31,.1);
}
.login-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(90deg, var(--c-inova) 0%, var(--c-inova) 49%, var(--c-formul) 51%, var(--c-formul) 100%);
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .8px;
  border-radius: 12px; text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  transition: transform .1s, box-shadow .2s, opacity .15s;
  margin-top: 6px;
}
.login-btn:active:not(:disabled) { transform: scale(.97); }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-msg {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 12px;
  font-weight: 600; display: none;
}
.login-msg.show { display: block; }
.login-msg.error { background: var(--c-danger-light); color: #B91C1C; border: 1px solid #FECACA; }
.login-msg.warn  { background: var(--c-warn-light);   color: #92400E; border: 1px solid #FCD34D; }
.login-msg.ok    { background: var(--c-success-light); color: #065F46; border: 1px solid #6EE7B7; }
.login-foot {
  text-align: center; margin-top: 14px; font-size: 10px; color: var(--c-text-3);
  font-weight: 600; letter-spacing: .5px;
}
.login-loading { display: inline-flex; align-items: center; gap: 10px; justify-content: center; width: 100%; }
.bike-anim { width: 20px; height: 20px; animation: bikeRide 1s linear infinite; }
@keyframes bikeRide {
  0% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 100% { transform: translateX(-4px); }
}

@media (max-width: 480px) {
  .split-content { padding: 20px 16px; max-width: 100%; }
  .split-titulo { font-size: 16px; }
  .split-sub { font-size: 9px; letter-spacing: 1px; }
  .split-line, .split-desc { display: none; }
  .split-logo { width: 64px; height: 64px; }
  .login-card { padding: 22px 20px 18px; max-width: 340px; }
}

/* ============================
   APP PRINCIPAL — header colorido por farmácia
   ============================ */
.app-header {
  background: linear-gradient(135deg, var(--t-grad-from) 0%, var(--t-grad-mid) 60%, var(--t-grad-to) 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  transition: background .35s ease;
}
.app-header::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.10) 1.5px, transparent 1.5px);
  background-size: 32px 32px;
  pointer-events: none;
}
.app-header > * { position: relative; z-index: 1; }

.app-header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 12px;
  gap: 10px; flex-wrap: wrap;
}
.app-user { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.app-user-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  flex-shrink: 0;
  backdrop-filter: blur(6px);
}
.app-user-info { min-width: 0; }
.app-user-ola { font-size: 11px; color: rgba(255,255,255,.8); font-weight: 600; letter-spacing: .3px; }
.app-user-name { font-weight: 800; font-size: 22px; color: #fff; line-height: 1.1; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-name .badge-adm {
  display: inline-block; vertical-align: middle;
  background: #FBBF24; color: #1F2937;
  padding: 2px 8px; border-radius: 6px;
  font-size: 9px; font-weight: 900; letter-spacing: .5px;
  margin-left: 6px;
}

.app-header-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.pill-btn {
  background: rgba(255,255,255,.95); color: var(--t-dark);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 5px;
  transition: transform .1s, box-shadow .15s;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
  position: relative;
  white-space: nowrap;
}
.pill-btn:active { transform: scale(.95); }
.pill-btn.dark {
  background: rgba(0,0,0,.4); color: #fff;
  border: 1.5px solid rgba(255,255,255,.4);
  backdrop-filter: blur(6px);
}
.pill-btn .bd {
  background: #FBBF24; color: #1A0606;
  padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 900; min-width: 18px;
  margin-left: 3px;
}
.gps-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #10B981; box-shadow: 0 0 0 2px rgba(16,185,129,.4);
}
.gps-dot.off { background: #EF4444; box-shadow: 0 0 0 2px rgba(239,68,68,.4); }

/* Toggle farmácia: GRANDES, DESTAQUE */
.farmacia-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 14px 12px;
}
.farmacia-tab {
  padding: 11px 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 13px;
  color: var(--c-text-2);
  transition: all .22s;
  position: relative;
  border: 2px solid transparent;
}
.farmacia-tab img {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; padding: 1.5px; object-fit: contain;
  filter: grayscale(.6); opacity: .85;
  transition: all .2s;
}
.farmacia-tab.active {
  background: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
  transform: translateY(-1px);
}
.farmacia-tab.active.inova  { color: var(--c-inova-dark); border-color: var(--c-inova); }
.farmacia-tab.active.formul { color: var(--c-formul-dark); border-color: var(--c-formul); }
.farmacia-tab.active img { filter: none; opacity: 1; }
.farmacia-tab .count {
  background: rgba(0,0,0,.06); color: var(--c-text-2);
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 900; min-width: 24px; text-align: center;
}
.farmacia-tab.active.inova .count  { background: var(--c-inova); color: #fff; }
.farmacia-tab.active.formul .count { background: var(--c-formul); color: #fff; }
.farmacia-tab.disabled { opacity: .4; pointer-events: none; }

/* Mini-resumo */
.mini-resumo {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 12px 10px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}
.mr-item {
  background: #F9FAFB; border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 58px;
  transition: all .2s;
}
.mr-vlr { font-size: 20px; font-weight: 900; color: var(--c-text); line-height: 1; }
.mr-lbl { font-size: 9px; color: var(--c-text-2); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-top: 5px; }
.mr-item.pulsando {
  background: #FFD700; border-color: #B8860B;
  animation: mrPulseAcertar 1.4s ease-in-out infinite;
}
.mr-item.pulsando .mr-vlr { color: #5C3D00; }
.mr-item.pulsando .mr-lbl { color: #7A5500; }
.mr-item.pulsando-urgente {
  background: var(--c-inova); border-color: var(--c-inova-dark);
  animation: mrPulseUrgente 1s ease-in-out infinite;
}
.mr-item.pulsando-urgente .mr-vlr { color: #fff; }
.mr-item.pulsando-urgente .mr-lbl { color: #FEE2E2; }
@keyframes mrPulseAcertar {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,184,0,0); }
  50%      { box-shadow: 0 0 0 6px rgba(255,184,0,0.45); }
}
@keyframes mrPulseUrgente {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,31,31,0); }
  50%      { box-shadow: 0 0 0 8px rgba(255,31,31,0.4); }
}

/* Totalbar — visão geral de todos os status */
.totalbar {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-around;
  background: #1F2937; color: #fff;
  padding: 10px 12px;
  font-size: 12px; font-weight: 700;
  border-bottom: 1px solid var(--c-border);
}
.totalbar b { color: #FBBF24; font-weight: 900; margin-right: 2px; }
.totalbar span:first-child { color: #FBBF24; font-weight: 800; }
.totalbar span:first-child b { color: #fff; }

/* Sub-tabs */
.sub-tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 10px 8px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  padding: 8px 13px;
  white-space: nowrap;
  font-size: 12px; font-weight: 800;
  color: var(--c-text-2);
  background: #F3F4F6;
  border-radius: 999px;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
  letter-spacing: .2px;
}
.sub-tab.active {
  background: var(--t-main);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.sub-tab .count {
  background: rgba(0,0,0,.08);
  padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 900;
}
.sub-tab.active .count { background: rgba(255,255,255,.25); color: #fff; }

/* Busca + filtros */
.controls-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; padding: 10px 36px 10px 36px;
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  background: #F9FAFB;
}
.search-wrap input:focus {
  outline: none; border-color: var(--t-main); background: #fff;
}
.search-wrap .ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; pointer-events: none;
}
.search-wrap .clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: #F3F4F6; width: 24px; height: 24px;
  border-radius: 50%; font-weight: 800; color: var(--c-text-2);
  display: none; align-items: center; justify-content: center;
  font-size: 13px;
}
.search-wrap.has-value .clear { display: inline-flex; }
.periodo-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.periodo-row .lbl { font-size: 11px; font-weight: 700; color: var(--c-text-2); }
.periodo-row .btn-periodo {
  padding: 5px 11px; border-radius: 8px;
  background: #fff; border: 1px solid var(--c-border);
  font-size: 11px; font-weight: 800; color: var(--c-text-2);
}
.periodo-row .btn-periodo.active {
  background: #1F2937; color: #fff; border-color: #1F2937;
}

main { padding: 10px 10px 80px; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  position: relative; overflow: hidden;
}
.card.urgente {
  border: 2px solid var(--c-inova);
  background: linear-gradient(180deg, #FFF8F8 0%, #fff 60%);
  animation: urgentePulse 1.4s ease-in-out infinite;
}
@keyframes urgentePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,31,31,0); }
  50%      { box-shadow: 0 0 0 4px rgba(255,31,31,0.15); }
}
.card.urgente::before {
  content: '🔥 URGENTE'; position: absolute; top: 0; right: 0;
  background: var(--c-inova); color: #fff; padding: 4px 12px;
  font-size: 10px; font-weight: 900; letter-spacing: 1px;
  border-bottom-left-radius: 10px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 8px; flex-wrap: wrap;
}
.card-pedido {
  font-size: 11px; color: var(--c-text-2); font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
}
.pedido-num {
  font-size: 16px; font-weight: 900;
  color: #15803D;
  background: #BEF264;
  padding: 2px 9px; border-radius: 7px;
  letter-spacing: .3px;
  border: 1px solid #84CC16;
}
.bairro-rota {
  display: inline-block;
  background: #FDE047; color: #713F12;
  padding: 1px 7px; border-radius: 5px;
  font-size: 11px; font-weight: 900;
  margin-right: 4px;
  letter-spacing: .3px;
}
.card-motoboy {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px;
  background: #EDE9FE; color: #5B21B6;
  padding: 4px 11px; border-radius: 8px;
  font-size: 12.5px; font-weight: 800;
  border: 1px solid #C4B5FD;
}
.card-motoboy.meu {
  background: #DCFCE7; color: #14532D;
  border-color: #86EFAC;
}
.farmacia-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 4px;
  border-radius: 999px;
  font-size: 10px; font-weight: 900; letter-spacing: .4px;
}
.farmacia-tag img {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; padding: 1px; object-fit: contain;
}
.farmacia-tag.inova  { background: var(--c-inova-light); color: var(--c-inova-dark); }
.farmacia-tag.formul { background: var(--c-formul-light); color: var(--c-formul-dark); }

.card-status {
  font-size: 10px; padding: 3px 10px; border-radius: 999px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .6px;
}
.card-status.aguardando { background: var(--c-warn-light); color: #92400E; }
.card-status.em_rota    { background: #DBEAFE; color: #1E40AF; }
.card-status.finalizado { background: var(--c-success-light); color: #065F46; }
.card-status.acertada   { background: #F3E8FF; color: #6B21A8; }
.card-status.aceito     { background: #DBEAFE; color: #1E40AF; }
.card-status.em_producao{ background: #F3F4F6; color: #4B5563; }

.card-cliente {
  font-size: 17px; font-weight: 800; color: var(--c-text);
  margin-bottom: 2px; line-height: 1.2;
}
.card-info {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--c-text-2); font-weight: 600;
  margin-bottom: 6px;
}
.card-info .hora-tag {
  background: #F3F4F6; padding: 2px 8px; border-radius: 6px;
  font-weight: 800; color: var(--c-text);
}
.card-endereco {
  font-size: 13.5px; color: var(--c-text); font-weight: 600;
  margin: 8px 0 4px;
  line-height: 1.4;
}
.card-bairro {
  display: inline-block; padding: 2px 9px; border-radius: 6px;
  background: #F3F4F6; color: var(--c-text-2);
  font-size: 11px; font-weight: 700;
}

.card-pagamento {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin: 10px 0 4px;
}
.pag-tag {
  font-size: 11px; padding: 4px 10px; border-radius: 8px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid transparent;
}
.pag-tag.receber { background: var(--c-success-light); color: #065F46; border-color: #A7F3D0; }
.pag-tag.pago    { background: #F3F4F6; color: var(--c-text-2); }
.pag-tag.pix     { background: var(--c-info-light); color: #1E40AF; border-color: #93C5FD; }
.pag-tag.cartao  { background: #EDE9FE; color: #5B21B6; border-color: #C4B5FD; }
.pag-tag.prom    { background: var(--c-warn-light); color: #92400E; border-color: #FCD34D; }
.pag-tag.troco   { background: #F3F4F6; color: var(--c-text-2); }

.card-receita {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: #1F2937;
  color: #FBBF24; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
  margin: 8px 0 4px;
}

.card-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 12px;
}
.btn {
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800; font-size: 12px; letter-spacing: .3px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: transform .1s, filter .15s, opacity .15s;
  text-transform: uppercase;
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:hover:not(:disabled)  { filter: brightness(.95); }
/* Aceitar = AZUL (pedido do usuário) */
.btn-aceitar  { background: #2563EB; color: #fff; }
.btn-rota     { background: #F59E0B; color: #fff; }
.btn-finalizar{ background: #10B981; color: #fff; }
.btn-secondary{ background: #F3F4F6; color: var(--c-text); }
.btn-danger   { background: #EF4444; color: #fff; }
.btn-wa       { background: #25D366; color: #fff; }
.btn-info     { background: var(--t-main); color: #fff; }
.btn-warn     { background: #F59E0B; color: #fff; }
.btn-full     { width: 100%; }
.btn-grow     { flex: 1 1 120px; }
.btn-sm       { padding: 6px 10px; font-size: 10.5px; border-radius: 8px; }

.empty {
  text-align: center; color: var(--c-text-2);
  padding: 60px 20px;
  font-size: 14px; font-weight: 600;
}
.empty .emoji { font-size: 56px; margin-bottom: 12px; display: block; opacity: .35; }

/* Modais */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(4px);
  z-index: 100; display: none; align-items: flex-end;
  animation: modalBgIn .2s ease;
}
.modal-bg.show { display: flex; }
@keyframes modalBgIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 480px; margin: 0 auto;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 22px 20px;
  max-height: 90vh; overflow-y: auto;
  animation: modalUp .25s cubic-bezier(.22,1,.36,1);
}
@media (min-width: 600px) {
  .modal-bg { align-items: center; }
  .modal { border-radius: 20px; }
}
@keyframes modalUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h3 { margin-bottom: 14px; font-size: 18px; font-weight: 800; color: var(--c-text); }
.modal .modal-row { margin-bottom: 12px; }
.modal .modal-row label { display: block; font-size: 11px; font-weight: 800; color: var(--c-text-2); margin-bottom: 5px; text-transform: uppercase; }
.modal .modal-row input,
.modal .modal-row select,
.modal .modal-row textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--c-border); border-radius: 10px;
  background: #F9FAFB; font-size: 14px;
}
.modal .modal-row textarea { resize: vertical; min-height: 70px; }

.opcoes-msg {
  display: flex; flex-direction: column; gap: 6px;
}
.opcoes-msg button {
  text-align: left;
  background: #F9FAFB; border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}
.opcoes-msg button:hover { background: #F3F4F6; }
.opcoes-msg .emoji { font-size: 18px; }

.dash-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 14px;
}
.dash-card {
  background: #F9FAFB; border: 1px solid var(--c-border);
  border-radius: 12px; padding: 12px;
  text-align: center;
}
.dash-card .v { font-size: 22px; font-weight: 900; color: var(--c-text); }
.dash-card .l { font-size: 10px; font-weight: 700; color: var(--c-text-2); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.dash-rank { background: #1F2937; color: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.dash-rank h4 { font-size: 11px; color: #FBBF24; margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.dash-rank ol { padding-left: 22px; font-size: 13px; }
.dash-rank ol li { padding: 3px 0; }

/* Tempos médios */
.dash-tempos { margin-bottom: 12px; }
.dash-tempos h4 { font-size: 11px; color: var(--c-text-2); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.tempos-loja {
  background: #F9FAFB; border: 1px solid var(--c-border);
  border-radius: 12px; padding: 12px; margin-bottom: 8px;
}
.tempos-loja .tnome { font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.tempos-loja .tnome.inova  { color: var(--c-inova-dark); }
.tempos-loja .tnome.formul { color: var(--c-formul-dark); }
.tempos-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; }
.tempos-grid .tcel { text-align: center; }
.tempos-grid .tval { font-size: 16px; font-weight: 900; color: var(--c-text); }
.tempos-grid .tlbl { font-size: 9px; color: var(--c-text-2); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; margin-top: 3px; }

/* Histórico */
.hist-dia {
  font-size: 11px; font-weight: 800; color: var(--c-text-2);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 4px; border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.hist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; border-bottom: 1px solid var(--c-border);
  font-size: 12px;
}
.hist-item .hist-st {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.hist-item .hist-st.finalizado { background: var(--c-success); }
.hist-item .hist-st.nao_entregue { background: var(--c-danger); }
.hist-item .hist-info { flex: 1; min-width: 0; }
.hist-item .hist-cli { font-weight: 700; font-size: 13px; color: var(--c-text); }
.hist-item .hist-meta { font-size: 11px; color: var(--c-text-2); }
.hist-item .hist-tag {
  font-size: 9px; padding: 2px 6px; border-radius: 4px;
  font-weight: 800; flex-shrink: 0;
}
.hist-item .hist-tag.inova  { background: var(--c-inova-light); color: var(--c-inova-dark); }
.hist-item .hist-tag.formul { background: var(--c-formul-light); color: var(--c-formul-dark); }

/* Banner instalar PWA */
.install-banner {
  display: none;
  background: linear-gradient(135deg, #2563EB 0%, #1E40AF 100%);
  color: #fff;
  padding: 12px 14px;
  margin: 10px;
  border-radius: 14px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  box-shadow: 0 8px 20px rgba(37,99,235,.3);
  flex-wrap: wrap;
}
.install-banner.show { display: flex; }
.install-banner .txt { flex: 1; min-width: 160px; }
.install-banner b { font-weight: 800; font-size: 13px; }
.install-banner button {
  background: #FBBF24; color: #1F2937;
  padding: 8px 14px; border-radius: 8px;
  font-weight: 900; font-size: 11px; letter-spacing: .5px;
  white-space: nowrap;
}

/* Cronômetro nas entregas urgentes/atrasadas */
.cron-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: #FFD700; color: #5C3D00;
  padding: 2px 8px; border-radius: 6px;
  font-size: 10px; font-weight: 900; letter-spacing: .3px;
  margin-left: 4px;
}
.cron-tag.alerta {
  background: var(--c-inova); color: #fff;
  animation: cronPulse 1.2s ease-in-out infinite;
}
@keyframes cronPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,31,31,0); }
  50%      { box-shadow: 0 0 0 4px rgba(255,31,31,.3); }
}

/* Card "PRÓXIMA ENTREGA" destacado (rota inteligente) */
.card.proxima {
  border: 3px solid var(--c-success) !important;
  box-shadow: 0 8px 24px rgba(16,185,129,.3) !important;
  transform: scale(1.01);
  position: relative;
}
.card.proxima::after {
  content: '🎯 PRÓXIMA';
  position: absolute; top: 6px; left: 6px;
  background: var(--c-success); color: #fff;
  padding: 3px 10px; border-radius: 6px;
  font-size: 9px; font-weight: 900; letter-spacing: 1px;
  z-index: 2;
}

/* Status motoboys (online/offline) */
.mb-status-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: #F9FAFB; border: 1px solid var(--c-border);
  border-radius: 10px; margin-bottom: 6px;
  font-size: 12px;
}
.mb-status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.mb-status-dot.online { background: var(--c-success); box-shadow: 0 0 0 2px rgba(16,185,129,.3); }
.mb-status-dot.offline { background: #9CA3AF; }
.mb-status-dot.recente { background: var(--c-warn); }
.mb-status-info { flex: 1; }
.mb-status-nome { font-weight: 700; }
.mb-status-meta { font-size: 10px; color: var(--c-text-2); }

/* Distância e ETA */
.dist-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: #DBEAFE; color: #1E40AF;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 800;
  margin-left: 4px;
}
.dist-tag.perto { background: var(--c-success-light); color: #065F46; }
.dist-tag.longe { background: var(--c-warn-light); color: #92400E; }

/* Notas internas */
.card-obs {
  background: #FEF3C7; border: 1px solid #FCD34D;
  color: #78350F; padding: 8px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  margin: 8px 0 4px;
  display: flex; gap: 6px; align-items: flex-start;
}
.card-obs::before { content: '📝'; }

/* Modo escuro (após 18h) */
body.dark { background: #0F172A; color: #E5E7EB; }
body.dark .mini-resumo,
body.dark .sub-tabs,
body.dark .controls-row,
body.dark .totalbar { background: #1E293B; border-color: #334155; }
body.dark .mr-item { background: #0F172A; border-color: #334155; color: #E5E7EB; }
body.dark .mr-vlr { color: #fff; }
body.dark .mr-lbl { color: #94A3B8; }
body.dark .sub-tab { background: #334155; color: #CBD5E1; }
body.dark .card { background: #1E293B; border-color: #334155; color: #E5E7EB; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
body.dark .card-cliente { color: #fff; }
body.dark .card-endereco { color: #CBD5E1; }
body.dark .card-info { color: #94A3B8; }
body.dark .card-bairro,
body.dark .card-info .hora-tag { background: #0F172A; color: #E5E7EB; }
body.dark .btn-secondary { background: #334155; color: #E5E7EB; }
body.dark .search-wrap input { background: #0F172A; border-color: #334155; color: #fff; }
body.dark .periodo-row .btn-periodo { background: #1E293B; color: #CBD5E1; border-color: #334155; }
body.dark .periodo-row .btn-periodo.active { background: #FBBF24; color: #1F2937; border-color: #FBBF24; }
body.dark .modal { background: #1E293B; color: #E5E7EB; }
body.dark .modal h3 { color: #fff; }
body.dark .dash-card,
body.dark .tempos-loja,
body.dark .mb-status-row { background: #0F172A; border-color: #334155; }
body.dark .dash-card .v, body.dark .tempos-grid .tval, body.dark .mb-status-nome { color: #fff; }
body.dark .pag-tag.pago, body.dark .pag-tag.troco { background: #334155; color: #CBD5E1; }
body.dark .pedido-num {
  background: #FDE047; color: #1F2937;
  border-color: #FACC15;
  box-shadow: 0 0 0 1px rgba(253, 224, 71, .35);
}
body.dark .bairro-rota {
  background: #FDE047; color: #1F2937;
}
body.dark .card-motoboy {
  background: #312E81; color: #C4B5FD; border-color: #4338CA;
}
body.dark .card-motoboy.meu {
  background: #064E3B; color: #86EFAC; border-color: #047857;
}

/* Modo dark indicador no header */
.dark-toggle {
  position: absolute; top: 6px; right: 6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #FBBF24; opacity: .6;
  z-index: 99;
}

/* Toast */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: #1F2937; color: #fff;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 700;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s;
  max-width: calc(100% - 32px);
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; }
.toast.error { background: var(--c-danger); }
.toast.success { background: var(--c-success); }

.loading-global {
  position: fixed; inset: 0; background: rgba(15,23,42,.4); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 300;
}
.loading-global.show { display: flex; }
.spinner {
  width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
