/* TrackBite — identidade visual aprovada: paleta Verde lucro (verde #00B26B, azul-marinho #0E2F57) e logo pino com rastro. */
:root {
  --bg: #F6F4EE;
  --card: #FFFFFF;
  --brand: #0E2F57;
  --brand-dark: #0A2240;
  --sky: #E6F6EE;
  --green: #00804D;
  --green-soft: #E6F6EE;
  --orange: #F28C28;
  --accent: #00B26B;
  --accent-dark: #009A5C;
  --orange-soft: #FDEBD8;
  --red: #C8372D;
  --red-soft: #FBE3E1;
  --text: #334155;
  --muted: #64748B;
  --line: #E6E1D6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(51,65,85,.06), 0 4px 16px rgba(51,65,85,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; color: #0E2F57; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.c2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .grid.c2 { grid-template-columns: 1fr; } }

/* Marca */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--brand); letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; background: url(/img/logo-mark.svg) center / contain no-repeat; flex: none; }
.logo span b { color: #00804D; }

/* Cartões e formulários */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #D4CEC0; border-radius: 10px; background: #fff; color: var(--text); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sky); border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none !important; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.orange { background: var(--accent); color: var(--brand); } .btn.orange:hover { background: var(--accent-dark); }
.btn.green { background: var(--green); } .btn.green:hover { background: #006A40; }
.btn.red { background: var(--red); } .btn.red:hover { background: #A92C24; }
.btn.ghost { background: #fff; color: var(--brand); border-color: #C9D3DF; } .btn.ghost:hover { background: var(--sky); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.big { padding: 15px 18px; font-size: 1.05rem; }

/* Etiquetas de situação */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--sky); color: var(--brand-dark); white-space: nowrap; }
.badge.pending { background: #EEF0F3; color: #475569; }
.badge.assigned { background: var(--sky); color: var(--brand-dark); }
.badge.in_transit { background: var(--orange-soft); color: #9A520C; }
.badge.arriving { background: var(--accent); color: var(--brand); }
.badge.delivered { background: var(--green-soft); color: #00663D; }
.badge.failed, .badge.cancelled, .badge.late, .badge.risk { background: var(--red-soft); color: var(--red); }
.badge.good { background: var(--green-soft); color: #00663D; }
.badge.attention { background: var(--orange-soft); color: #9A520C; }
.badge.new { background: #EEF0F3; color: #475569; }

/* Tabelas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #FBF9F4; }
.table-wrap { overflow-x: auto; }

/* Indicadores */
.kpi .v { font-size: 1.7rem; font-weight: 800; color: #0E2F57; }
.kpi .l { color: var(--muted); font-size: .85rem; }
.kpi.warn .v { color: var(--red); }

/* Avisos */
.toast-box { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #fff; border-left: 5px solid var(--brand); border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(51,65,85,.18); animation: tin .2s ease-out; }
.toast.ok { border-color: var(--green); } .toast.err { border-color: var(--red); } .toast.warn { border-color: var(--orange); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--orange-soft); color: #7A4108; border: 1px solid #F6CFA4; }
.alert.err { background: var(--red-soft); color: var(--red); border-color: #F2B8B3; }
.alert.ok { background: var(--green-soft); color: #00663D; border-color: #B5E3CE; }
.alert.info { background: var(--sky); color: var(--brand-dark); border-color: #B5E3CE; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(51,65,85,.35); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto; z-index: 1000; }
.modal { background: #fff; border-radius: var(--radius); width: min(720px, 100%); padding: 22px; box-shadow: 0 20px 60px rgba(51,65,85,.25); }
.modal .close { float: right; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* Layout do painel */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side nav { margin-top: 22px; display: flex; flex-direction: column; gap: 3px; }
.side nav a { padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 600; text-decoration: none; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: var(--bg); }
.side nav a.active { background: var(--sky); color: var(--brand-dark); }
.side .foot { margin-top: auto; font-size: .85rem; }
.main { padding: 24px; min-width: 0; }
.topbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 900; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 800; }
  .main { padding: 14px; }
}
.count { background: var(--orange); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; }

/* Mapas */
.map { height: 380px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.map.tall { height: 520px; }
.map.pick { height: 300px; cursor: crosshair; }
.pin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; font-weight: 800; }
.pin.rest { background: var(--brand); } .pin.dest { background: var(--green); } .pin.drv { background: var(--accent); } .pin.sos { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* Telas de acesso */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: min(430px, 100%); }
.auth-card .logo { margin-bottom: 18px; }

/* Celular (entregador e cliente) */
.mobile { max-width: 520px; margin: 0 auto; padding: 14px; padding-bottom: 90px; }
.mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stop { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; margin-bottom: 10px; }
.stop.current { border: 2px solid var(--accent); }
.stop .addr { font-weight: 700; font-size: 1.05rem; }
.code-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-weight: 800; }
.sos-btn { position: fixed; right: 16px; bottom: 16px; width: 66px; height: 66px; border-radius: 50%; background: var(--red); color: #fff; border: 4px solid #fff; font-weight: 900; font-size: 1rem; box-shadow: 0 6px 20px rgba(200,55,45,.45); cursor: pointer; z-index: 950; }
.bigcode { font-size: 2.2rem; font-weight: 900; letter-spacing: .25em; color: var(--brand-dark); text-align: center; background: var(--sky); border-radius: 12px; padding: 10px; }
.steps { display: flex; justify-content: space-between; margin: 14px 0; }
.steps div { flex: 1; text-align: center; font-size: .75rem; color: var(--muted); position: relative; }
.steps div::before { content: ""; display: block; width: 16px; height: 16px; margin: 0 auto 6px; border-radius: 50%; background: #E2DDD2; }
.steps div.on { color: var(--brand-dark); font-weight: 700; }
.steps div.on::before { background: var(--brand); }
.stars { display: flex; gap: 6px; justify-content: center; }
.stars button { font-size: 2rem; background: none; border: none; cursor: pointer; color: #D6D0C2; padding: 0; }
.stars button.on { color: var(--orange); }

/* Página inicial */
.hero { max-width: 1100px; margin: 0 auto; padding: 30px 20px 50px; }
.hero header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 50px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); max-width: 760px; }
.hero p.lead { font-size: 1.15rem; max-width: 640px; color: var(--muted); }
.feat { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 40px; }
.feat .card h3 { color: var(--brand-dark); }
.num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--brand); font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }

/* Impressão do comprovante com QR */
.print-slip { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-slip, .print-slip * { visibility: visible; }
  .print-slip { display: block !important; position: absolute; left: 0; top: 0; width: 80mm; padding: 4mm; font-size: 12px; color: #000; }
  .print-slip img { width: 60mm; height: 60mm; }
}

/* Ajustes após auditoria visual */
.grid > .card + .card, .grid > .card { margin-top: 0; }
body { overflow-x: hidden; }
.chart { display: flex; gap: 4px; align-items: flex-end; height: 140px; }
.chart > div { flex: 1; min-width: 0; text-align: center; }
.chart .lbl { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
@media (max-width: 600px) {
  .chart .lbl.odd { visibility: hidden; }
  .chart .mm { display: none; }
  .toast-box { left: 16px; right: 16px; bottom: 96px; max-width: none; }
}

/* Marcador do entregador: moto */
.moto-mk { position: relative; width: 46px; height: 60px; pointer-events: auto; }
.moto-mk .moto-shadow { position: absolute; left: 50%; top: 36px; width: 38px; height: 9px; margin-left: -19px; border-radius: 50%; background: rgba(31,95,174,.22); }
.moto-mk img { position: absolute; left: 0; top: 0; width: 46px; height: 46px; transition: transform .25s ease;
  filter: drop-shadow(0 0 1.2px #fff) drop-shadow(0 0 1.2px #fff) drop-shadow(0 2px 4px rgba(31,95,174,.35)); }
.moto-mk img.flip { transform: scaleX(-1); }
.moto-mk .moto-name { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 5px rgba(31,95,174,.3); }
.moto-mk .moto-name:empty { display: none; }

/* Linha do tempo da oferta de lançamento */
.offer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; position: relative; }
.offer-step { position: relative; padding: 14px 12px 12px 34px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.offer-step .offer-dot { position: absolute; left: 12px; top: 17px; width: 12px; height: 12px; border-radius: 50%; background: #E2DDD2; }
.offer-step.on { border: 2px solid var(--brand); background: var(--sky); }
.offer-step.on .offer-dot { background: var(--brand); box-shadow: 0 0 0 4px rgba(14,47,87,.18); }
.offer-step.done .offer-dot { background: var(--green); }
@media (max-width: 760px) { .offer { grid-template-columns: 1fr; } }
.alert.warn { background: #FFF4E5; color: #8A4B08; border-color: #F5CF9C; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0; cursor: pointer; }
label.check input { width: auto; margin: 0; }

/* Atendente virtual (página de rastreio) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid #C9D3DF; background: #fff; color: var(--brand); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.chips button:hover { background: var(--green-soft); border-color: var(--accent); }
.chat { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.chat:empty { display: none; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; line-height: 1.4; font-size: .95rem; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--green-soft); color: var(--text); border: 1px solid #CDEBDC; border-bottom-left-radius: 4px; }
.msg.bot .btn { margin-top: 8px; white-space: normal; }
.msg.typing { color: var(--muted); font-style: italic; }
#askForm input { flex: 1; }
.hl-virtual { margin-top: 40px; border: 2px solid var(--accent); background: linear-gradient(180deg, #fff 0%, var(--green-soft) 100%); }
.hl-virtual h3 { color: var(--brand-dark); margin: 10px 0 6px; font-size: 1.3rem; }
.tag-free { display: inline-block; background: var(--accent); color: var(--brand); font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 999px; letter-spacing: .02em; }

/* Origem do pedido (próprio / outra plataforma) */
.seg-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.seg-toggle label { flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid #D4CEC0; border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; margin: 0; }
.seg-toggle label:has(input:checked) { border-color: var(--accent); background: var(--green-soft); }
.seg-toggle input { width: auto; }
.ifood-box { background: #F4F2EC; border: 1px solid #E2DED3; border-left: 4px solid #EA1D2C; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.badge.ifood { background: #0E2F57; color: #fff; }

/* Recados rápidos do entregador */
.quick-msgs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.quick-msgs .chip { border: 1px solid #C9D3DF; background: #fff; color: var(--brand); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
.quick-msgs .chip:disabled { opacity: .5; }
label.check span { font-weight: 400; }

/* Selo Loja Fundadora (página de rastreio) */
.founder-seal{display:inline-flex;align-items:center;gap:6px;margin-left:8px;padding:3px 10px;border-radius:999px;background:#E6F6EE;color:#00804D;font-size:12px;font-weight:700;border:1px solid #9FDCBF;white-space:nowrap}
.founder-seal::before{content:'★';font-size:11px}
