/* Painel do vendedor do sistema (/vendedor/).
   Mesma identidade do super admin e da landing: tokens de /theme.css, entrada
   no verde-floresta, cartões claros. Folha própria de propósito — o CSS do
   super admin mora no caminho secreto do painel e não pode ser referenciado
   por uma página pública. */

:root {
  --bg: var(--sp-surface);
  --surface: var(--sp-white);
  --text: var(--sp-text);
  --muted: var(--sp-muted);
  --border: var(--sp-border);
  --primary: var(--sp-action);
  --danger: #b91c1c;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--primary); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
:is(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--sp-action); outline-offset: 2px;
}

/* ── Entrada (login e troca de senha) ── */
.tela-acesso {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--sp-forest) 0%, var(--sp-forest-deep) 100%);
}
.cartao-acesso {
  background: var(--surface); border-radius: 16px;
  padding: 36px 32px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 48px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.08);
}
.cartao-acesso .logo { display: flex; justify-content: center; margin-bottom: 12px; }
.cartao-acesso .logo img {
  height: 56px; width: auto; display: block;
  background: rgba(255,255,255,.96); border-radius: 10px; padding: 8px 14px;
}
.cartao-acesso .subtitulo {
  color: var(--sp-primary-dark); font-size: 14px; font-weight: 700; text-align: center;
  padding-bottom: 16px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.cartao-acesso .texto { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.rodape-acesso { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }
/* Convite para quem ainda não é vendedor: leva a /seja-vendedor (cadastro com acesso na hora). */
.cadastro-acesso {
  display: block; text-align: center; margin-top: 16px; padding: 12px 14px;
  border: 1px dashed var(--primary); border-radius: 10px;
  font-size: 14px; color: var(--text); text-decoration: none;
}
.cadastro-acesso strong { color: var(--primary); }
.cadastro-acesso:hover { background: var(--bg); }

.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.campo input {
  width: 100%; height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 16px; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.dica { font-size: 12px; color: var(--muted); margin-top: 5px; }

.erro-form {
  background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}

/* ── Botões ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--sp-action); color: #fff; box-shadow: 0 2px 6px rgba(22,163,74,.25); }
.btn-primary:hover:not(:disabled) { background: var(--sp-primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); background: var(--sp-surface); }
.btn-claro {
  background: var(--sp-glass-dark-bg); color: #fff; border-color: var(--sp-glass-dark-border);
}
.btn-claro:hover { background: var(--sp-glass-dark-hover); }
.btn-whatsapp { background: #128c7e; color: #fff; }
.btn-whatsapp:hover { background: #0e6f64; }
.btn-whatsapp svg { flex-shrink: 0; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn-bloco { width: 100%; }
.btn-link {
  display: block; margin: 14px auto 0; background: none; border: 0;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline;
}

/* ── Painel ── */
.topo { background: linear-gradient(135deg, var(--sp-forest), var(--sp-forest-deep)); color: #fff; }
.topo-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.topo-logo {
  height: 38px; width: auto; flex-shrink: 0;
  background: rgba(255,255,255,.96); border-radius: 8px; padding: 5px 10px;
}
.topo-ident { flex: 1; min-width: 0; }
.topo-ident strong {
  display: block; font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topo-ident small { display: block; font-size: 12px; color: var(--sp-border); }

.conteudo { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.painel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.painel h2 { font-size: 16px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 4px; }
.painel .sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.codigo-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.codigo {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 26px; font-weight: 800; letter-spacing: .08em; color: var(--sp-forest);
  background: var(--sp-surface); border: 1px dashed var(--sp-action); border-radius: 10px;
  padding: 6px 14px; overflow-wrap: anywhere;
}
.rotulo-link { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 6px; }
.link-linha { display: flex; flex-wrap: wrap; gap: 8px; }
.link-linha input {
  flex: 1 1 220px; min-width: 0; height: 42px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--sp-surface);
  font: inherit; font-size: 14px; color: var(--text);
}
.acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.totais { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.total {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; min-width: 0;
}
.total .rotulo {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.total .valor { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; overflow-wrap: anywhere; }
.total .nota { font-size: 12px; color: var(--muted); margin-top: 2px; }
.total.destaque { border-color: var(--sp-action); background: #f0fdf4; }

.passos { padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; }
.passos li::marker { color: var(--sp-action); font-weight: 700; }
.observacao { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* Clientes: tabela na tela larga, cartões no celular (sem rolagem lateral). */
.tabela { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tabela th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #fff; background: var(--sp-forest); padding: 11px 14px; font-weight: 700;
}
.tabela th:first-child { border-radius: 10px 0 0 0; }
.tabela th:last-child { border-radius: 0 10px 0 0; text-align: right; }
.tabela td { padding: 12px 14px; border-bottom: 1px solid var(--sp-surface); vertical-align: top; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela td.col-valor { text-align: right; font-weight: 700; white-space: nowrap; }
.nome-farmacia { font-weight: 700; overflow-wrap: anywhere; }

.status {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.status-pendente  { background: #f1f5f2; color: #475569; }
.status-carencia  { background: #fef3c7; color: #92400e; }
.status-liberada  { background: #dbeafe; color: #1e40af; }
.status-paga      { background: #dcfce7; color: #15803d; }
.status-cancelada { background: #fef2f2; color: #b91c1c; }
.status-detalhe { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.vazio { text-align: center; padding: 28px 12px; color: var(--muted); }
.carregando {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 12px; color: var(--muted); font-size: 13px;
}
.carregando img { width: 40px; height: 40px; animation: pulsar 1.25s ease-in-out infinite; }
@keyframes pulsar { 0%, 100% { transform: scale(.9); opacity: .55; } 50% { transform: scale(1.06); opacity: 1; } }

.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 32px);
}
.toast {
  padding: 12px 18px; border-radius: 10px; color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); max-width: 360px;
}
.toast-sucesso { background: var(--sp-action); }
.toast-erro { background: var(--danger); }
.toast-info { background: #1d4ed8; }

@media (max-width: 760px) {
  .totais { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cartao-acesso { padding: 28px 20px; }
  .conteudo { padding: 16px 12px 40px; }
  .painel { padding: 16px; }
  .codigo { font-size: 22px; }
  .total { padding: 12px; }
  .total .valor { font-size: 19px; }
  .acoes .btn { flex: 1 1 100%; }
  .tabela thead { display: none; }
  .tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
  .tabela tr { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .tabela td {
    border: 0; padding: 4px 0;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: right;
  }
  .tabela td::before {
    content: attr(data-rotulo); flex-shrink: 0; text-align: left;
    font-size: 12px; font-weight: 600; color: var(--muted);
  }
  .tabela td.col-farmacia { display: block; text-align: left; }
  .tabela td.col-farmacia::before { content: none; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
