/* Gestor Online — "mobile-shell" compartilhado entre os portais standalone
   (Motorista, Montador, Separador...). Extraído do CSS inline de
   portal-motorista.html (docs/prd-separador-mobile.md, seção 11 — UX
   Auditor: não copiar o mesmo bloco de estilos pela 3ª vez).

   Prefixo genérico `.pms-` (Portal Mobile Shell) pra não colidir com as
   classes `.mt-*` já em produção em portal-motorista.html/portal-montador
   (esses dois continuam com o CSS inline próprio por ora — migrá-los pra
   cá é um cleanup de baixo risco pra rodada futura, não feito aqui pra
   não mexer em tela já em uso real sem necessidade).

   Depende de public/css/design-system.css (tokens de tema) já carregado
   antes deste arquivo. */

html, body { margin: 0; height: 100%; touch-action: pan-y; }
body { font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
.pms-shell * { box-sizing: border-box; }

.pms-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; position: relative; background: var(--bg); }

/* ── Cabeçalho fixo, compacto ─────────────────────────────────────────── */
.pms-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; flex-shrink: 0;
}
.pms-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.pms-header-logo { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.pms-header-logo img { width: 34px; height: 34px; object-fit: contain; }
.pms-header-logo-branca { display: block; }
.pms-header-logo-cor { display: none; }
.pms-shell[data-theme="porcelain"] .pms-header-logo-branca { display: none; }
.pms-shell[data-theme="porcelain"] .pms-header-logo-cor { display: block; }
.pms-header-textos { min-width: 0; flex: 1; }
.pms-back-btn {
  width: 42px; height: 42px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
}
.pms-brand-title { font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pms-brand-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pms-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pms-tema-btn {
  width: 42px; height: 42px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.pms-tema-btn:active { background: var(--border); color: var(--text); }
.pms-tema-btn svg { width: 20px; height: 20px; }

.pms-sync-pill {
  display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; flex-shrink: 0; white-space: nowrap;
}
.pms-sync-ic {
  width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}
.pms-sync-ok { background: var(--success-soft); color: var(--success); }
.pms-sync-ok .pms-sync-ic { background: var(--success); }
.pms-sync-offline { background: var(--danger-soft); color: var(--danger); }
.pms-sync-offline .pms-sync-ic { background: var(--danger); }

.pms-wrap { flex: 1; display: flex; flex-direction: column; width: 100%; padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); position: relative; }

/* ── Login ────────────────────────────────────────────────────────────── */
.pms-login-shell { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; width: 100%; padding: 24px 0; }
.pms-login-logo-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.pms-login-logo { max-height: 76px; max-width: 280px; object-fit: contain; filter: drop-shadow(0 4px 18px rgba(0,0,0,.35)); }
.pms-login-logo-cor { display: none; }
.pms-shell[data-theme="porcelain"] .pms-login-logo-branca { display: none; }
.pms-shell[data-theme="porcelain"] .pms-login-logo-cor { display: inline-block; }
.pms-login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px 22px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-md);
}
.pms-login-title { font-size: 20px; font-weight: 800; color: var(--text); }
.pms-login-subtitle { font-size: 14.5px; color: var(--text-muted); margin-top: 4px; }
.pms-field-label { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.pms-login-card input.form-input { width: 100%; height: 50px; font-size: 16px; }
.pms-login-erro { color: var(--danger); font-size: 14.5px; }

/* ── Botões grandes (regra de ouro: uma ação óbvia por tela) ─────────── */
.pms-btn-primaria {
  width: 100%; min-height: 64px; border-radius: var(--radius-lg); border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 18.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 10px 30px -10px var(--primary-glow);
}
.pms-btn-primaria:active { transform: scale(.98); }
.pms-btn-primaria:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.pms-btn-secundaria {
  width: 100%; min-height: 58px; border-radius: var(--radius-lg); border: 1.5px solid var(--border); cursor: pointer;
  background: var(--card); color: var(--text); font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px;
}
.pms-btn-perigo.pms-btn-primaria { background: var(--danger); color: #fff; box-shadow: 0 10px 30px -10px var(--danger-soft); }
.pms-btn-perigo.pms-btn-secundaria { color: var(--danger); border-color: var(--danger-soft); }

.pms-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.pms-card[onclick] { cursor: pointer; }
.pms-card[onclick]:active { background: var(--card-hover); transform: scale(.985); box-shadow: none; }
.pms-card-title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.pms-card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pms-card-chevron { color: var(--text-muted); flex-shrink: 0; display: flex; }
.pms-resumo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pms-resumo-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.pms-resumo-item { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.pms-resumo-grid-3 .pms-resumo-item { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
.pms-resumo-item-ic { width: 26px; height: 26px; border-radius: 999px; background: var(--card); color: var(--text-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pms-resumo-item-ic svg { width: 13px; height: 13px; }
.pms-resumo-item b { display: block; font-family: var(--font-display); font-size: 17px; color: var(--text); line-height: 1.2; }
.pms-resumo-grid-3 .pms-resumo-item b { font-size: 15px; }
.pms-resumo-item span { font-size: 12.5px; color: var(--text-muted); }

/* ── Barra de progresso (pedidos liberados/separados) ─────────────────── */
.pms-progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; margin-bottom: 4px; }
.pms-progress-label { font-size: 12.5px; color: var(--text-muted); font-weight: 700; }
.pms-progress-valor { font-size: 13.5px; color: var(--text); font-weight: 800; font-family: var(--font-display); }
.pms-progress-track { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pms-progress-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s ease; }
.pms-progress-fill.pms-progress-completa { background: var(--success); }

/* ── Escolha binária (ícone + título + subtítulo) ────────────────────── */
.pms-opcoes-grid { display: flex; flex-direction: column; gap: 10px; }
.pms-opcao-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--card); cursor: pointer; text-align: left; font-family: inherit;
}
.pms-opcao-btn:active { background: var(--surface-2); }
.pms-opcao-btn.pms-opcao-btn-selecionado { border-color: var(--primary); background: var(--primary-soft); }
.pms-opcao-ic { width: 42px; height: 42px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pms-opcao-titulo { font-size: 16px; font-weight: 700; color: var(--text); }
.pms-opcao-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Item de conferência/separação (borda/fundo ok/problema) ─────────── */
.pms-item-conf-lista { display: flex; flex-direction: column; gap: 8px; }
.pms-item-conf {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-lg);
  border: 2px solid var(--border); background: var(--card); transition: background .12s ease, border-color .12s ease;
}
.pms-item-conf-ic { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.pms-item-conf-ic.pms-item-conf-ic-foto { width: 64px; height: 64px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.pms-item-conf-ic-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.pms-item-conf-corpo { flex: 1; min-width: 0; }
.pms-item-conf-nome { font-size: 16.5px; font-weight: 700; color: var(--text); }
.pms-item-conf-qtd-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 4px 12px;
  border-radius: 999px; background: var(--primary-soft); color: var(--primary);
  font-size: 13px; font-weight: 600;
}
.pms-item-conf-qtd-chip b { font-weight: 800; font-size: 19px; }
.pms-item-conf-qtd-chip.pms-status-progresso { background: var(--warning-soft); color: var(--warning); }
.pms-item-conf-qtd-chip.pms-status-concluido { background: var(--success-soft); color: var(--success); }
.pms-item-conf-qtd-chip.pms-status-bloqueado { background: var(--surface-2); color: var(--text-muted); }
.pms-item-conf.pms-item-conf-ok { border-color: var(--success); background: var(--success-soft); }
.pms-item-conf.pms-item-conf-ok .pms-item-conf-ic { color: var(--success); }
.pms-item-conf.pms-item-conf-problema { border-color: var(--danger); background: var(--danger-soft); }
.pms-item-conf.pms-item-conf-problema .pms-item-conf-ic { color: var(--danger); }
.pms-item-conf-badge {
  font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; gap: 3px; white-space: nowrap;
}
.pms-item-conf-badge-ok { background: var(--success); color: #fff; }
.pms-item-conf-badge-problema { background: var(--danger); color: #fff; }
.pms-item-conf-acoes { display: flex; gap: 6px; flex-shrink: 0; }
.pms-item-conf-acoes button {
  height: 38px; padding: 0 14px; border-radius: var(--radius); border: 1.5px solid var(--border); background: none;
  color: var(--text-muted); font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.pms-item-conf-acoes button.pms-acao-ativa-ok { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.pms-item-conf-acoes button.pms-acao-ativa-problema { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }

/* ── Rastreador de etapa (login > home > detalhe...) ──────────────────── */
.pms-etapas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.pms-etapa {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--card); opacity: .5; transition: opacity .15s ease, border-color .15s ease;
}
.pms-etapa.pms-etapa-atual { opacity: 1; border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.pms-etapa.pms-etapa-feita { opacity: .75; }
.pms-etapa-ic { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--surface-2); color: var(--text-muted); }
.pms-etapa.pms-etapa-atual .pms-etapa-ic { background: var(--primary); color: #fff; }
.pms-etapa.pms-etapa-feita .pms-etapa-ic { background: var(--success); color: #fff; }

.pms-foto-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 30px 16px; cursor: pointer;
  background: var(--surface-2); color: var(--text-muted); text-align: center;
}
.pms-foto-box.pms-foto-preenchida { border-style: solid; border-color: var(--success); background: var(--success-soft); color: var(--success); }
.pms-foto-preview { max-width: 100%; max-height: 220px; border-radius: var(--radius); margin-top: 10px; }

.pms-vazio { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.pms-vazio-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }

.pms-skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: pms-skel 1.4s ease infinite; border-radius: var(--radius); }
@keyframes pms-skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@keyframes pms-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
#pms-mount > * { animation: pms-fade-in .25s ease both; }

/* ── Toast/confirmação próprios — página standalone, sem utils.js da SPA ── */
#pms-toast-host {
  position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 14px; pointer-events: none; max-width: 560px; margin: 0 auto;
}
.pms-toast {
  pointer-events: auto; width: 100%; max-width: 420px; display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-lg); background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); font-size: 15px; font-weight: 600; color: var(--text);
  animation: pms-toast-in .2s ease both;
}
.pms-toast.pms-toast-saindo { animation: pms-toast-out .18s ease both; }
@keyframes pms-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pms-toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }
.pms-toast-sucesso { border-color: var(--success); color: var(--success); }
.pms-toast-erro { border-color: var(--danger); color: var(--danger); }
.pms-toast-aviso { border-color: var(--warning); color: var(--warning); }
.pms-toast-ic { flex-shrink: 0; display: flex; }
.pms-toast-msg { color: var(--text); flex: 1; }

/* ── Modal bottom-sheet (design system não tem sheet mobile próprio ainda —
   ver docs/design-system/ux-auditor.md achado 12; este é o mesmo padrão já
   usado pelo Portal do Motorista, reaproveitado aqui) ────────────────── */
.pms-modal-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  animation: pms-modal-fade .15s ease both;
}
@keyframes pms-modal-fade { from { opacity: 0; } to { opacity: 1; } }
.pms-modal {
  width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px 18px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; animation: pms-modal-up .2s ease both;
  max-height: 100%; overflow-y: auto;
}
@keyframes pms-modal-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pms-modal-titulo { font-family: var(--font-display); font-size: 18.5px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.pms-modal-msg { font-size: 15px; color: var(--text-muted); line-height: 1.5; }
.pms-modal-item-card { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; }
.pms-modal-item-nome { font-size: 16px; font-weight: 700; color: var(--text); }
.pms-modal-item-sub { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.pms-modal-botoes { display: flex; gap: 10px; margin-top: 4px; align-items: stretch; }
.pms-modal-botoes .pms-btn-primaria, .pms-modal-botoes .pms-btn-secundaria { min-height: 50px; margin-top: 0; flex: 1; }

/* ── Stepper de quantidade (registrar falta: quantidade encontrada) ──── */
.pms-qtd-stepper { display: flex; align-items: stretch; gap: 10px; }
.pms-qtd-btn {
  width: 68px; height: 68px; flex-shrink: 0; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 30px; font-weight: 700; -webkit-tap-highlight-color: transparent;
}
.pms-qtd-btn:active { background: var(--border); transform: scale(.96); }
.pms-qtd-valor {
  flex: 1; min-width: 0; height: 68px; width: 100%; text-align: center; font-size: 30px; font-weight: 800; color: var(--text);
  border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--card);
  display: flex; align-items: center; justify-content: center; transition: color .12s ease, border-color .12s ease;
  font-family: inherit; padding: 0; -webkit-appearance: none; appearance: none;
}
.pms-qtd-valor:focus { outline: none; border-color: var(--primary); }
.pms-qtd-valor::-webkit-outer-spin-button, .pms-qtd-valor::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pms-qtd-valor.pms-qtd-valor-zero { color: var(--danger); border-color: var(--danger-soft); }
.pms-qtd-valor.pms-qtd-valor-parcial { color: var(--warning); border-color: var(--warning-soft); }

/* ── Badge de aviso (pedido cancelado/carga atrasada) ─────────────────── */
.pms-badge-aviso {
  display: flex; align-items: center; gap: 6px; background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius); padding: 9px 13px; font-size: 13.5px; font-weight: 700; margin-bottom: 10px;
}

/* ── Navegação inferior ────────────────────────────────────────────────── */
.pms-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-width: 560px; margin: 0 auto;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.pms-nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 4px;
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12.5px; font-weight: 700; font-family: inherit;
  position: relative; border-radius: var(--radius);
}
.pms-nav-btn svg { transition: transform .12s ease; }
.pms-nav-btn:active svg { transform: scale(.88); }
.pms-nav-btn.active { color: var(--primary); }
.pms-nav-btn.active::before {
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary);
}
.pms-nav-badge {
  position: absolute; top: 0; right: 22%; min-width: 16px; height: 16px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ── Cronômetro de fechamento da carga ────────────────────────────────── */
.pms-cronometro { font-family: var(--font-display); font-size: 17px; font-weight: 800; }
.pms-cronometro-ok { color: var(--success); }
.pms-cronometro-atencao { color: var(--warning); }
.pms-cronometro-critico { color: var(--danger); }
