/* ==========================================================================
   Controle Comercial de Pedidos — base (tema claro no padrão Dynamics/Fluent,
   o mesmo do Painel de Pedidos da Expedição: Segoe UI, azul #0f6cbd, neutros).
   ========================================================================== */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #faf9f8;
  --surface: #ffffff;
  --surface2: #f3f2f1;
  --surface3: #edebe9;
  --line: #e1dfdd;
  --line-soft: #edebe9;
  --text: #242424;
  --text2: #605e5c;
  --text3: #8a8886;
  --primary: #0f6cbd;
  --primary-hover: #115ea3;
  --primary-soft: #e8f1fb;
  --ok: #107c10;      --ok-bg: #dff6dd;
  --warn: #8a4d00;    --warn-bg: #fff4ce;   --warn-ink: #c87a00;
  --late: #a4262c;    --late-bg: #fde7e9;   --late-ink: #c50f1f;
  --pay: #5c2e91;     --pay-bg: #efe6fa;    --pay-ink: #8764b8;
  --wait: #3b5b8a;    --wait-bg: #e0e7f5;   --wait-ink: #5c7ea8;
  --teal: #03676a;    --teal-bg: #d9f2f2;   --teal-ink: #038387;
  --done: #0f6cbd;    --done-bg: #e8f1fb;
  --none: #605e5c;    --none-bg: #f3f2f1;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
  --shadow-pop: 0 8px 28px rgba(0,0,0,.16), 0 2px 6px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; line-height: 1.4;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ barra superior */
.barra {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
  height: 48px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.marca { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; min-width: 0; }
.marca span { overflow: hidden; text-overflow: ellipsis; }
.menu { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.menu::-webkit-scrollbar { display: none; }
.menu a { padding: 6px 10px; border-radius: 4px; color: var(--text2); text-decoration: none; font-weight: 600; white-space: nowrap; }
.menu a:hover { background: var(--surface2); color: var(--text); }
.menu a.ativo { color: var(--primary); background: var(--primary-soft); }
.conta { position: relative; margin-left: auto; }
.conta summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.conta summary::-webkit-details-marker { display: none; }
.conta summary:hover { background: var(--surface2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto; }
.conta-nome { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conta-pop {
  position: absolute; right: 0; top: 40px; min-width: 220px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; z-index: 50;
}
.conta-quem { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; display: flex; flex-direction: column; }
.conta-quem small { color: var(--text2); }
.conta-pop a, .conta-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 4px;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.conta-pop a:hover, .conta-pop button:hover { background: var(--surface2); }
.conta-pop form { margin: 0; }

/* ------------------------------------------------------------------ botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 4px;
  font-weight: 600; cursor: pointer; border: 1px solid #8a8886; background: var(--surface); color: var(--text);
  white-space: nowrap; text-decoration: none; font-size: 13px;
}
.btn:hover { background: var(--surface2); }
.btn:focus-visible, .campo input:focus-visible, .campo select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn.primario { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primario:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.perigo { border-color: var(--late-ink); color: var(--late); }
.btn.perigo:hover { background: var(--late-bg); }
.btn.sucesso { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sucesso:hover { background: #0b6a0b; }
.btn.fantasma { border-color: transparent; background: transparent; color: var(--primary); padding: 0 8px; }
.btn.fantasma:hover { background: var(--primary-soft); }
.btn.pequeno { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.largo { width: 100%; height: 38px; }
.btn:disabled { opacity: .5; cursor: default; }

.form { display: flex; flex-direction: column; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo > span { font-size: 12px; font-weight: 600; color: var(--text2); }
.campo input, .campo select, .campo textarea {
  height: 34px; padding: 0 10px; border: 1px solid #8a8886; border-radius: 4px; background: var(--surface); font-size: 14px;
}
.campo textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.campo input:hover, .campo select:hover, .campo textarea:hover { border-color: var(--text); }
.dica { margin: 0; color: var(--text2); font-size: 12px; }
.acoes-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.alerta { padding: 10px 12px; border-radius: 6px; margin: 0 0 12px; border: 1px solid transparent; }
.alerta.erro { background: var(--late-bg); color: var(--late); border-color: #f1bbbc; }
.alerta.sucesso { background: var(--ok-bg); color: var(--ok); border-color: #9fd89f; }
.alerta.info { background: var(--primary-soft); color: #0e4775; border-color: #b4d6fa; }
.alerta.aviso { background: var(--warn-bg); color: var(--warn); border-color: #f8e08e; }

/* ------------------------------------------------------------------ login */
.tela-login { background: linear-gradient(160deg, #e8f1fb 0%, #faf9f8 45%, #f3f2f1 100%); min-height: 100vh; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-cartao {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 28px 24px 22px;
}
.login-marca { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-marca h1 { font-size: 18px; margin: 0; line-height: 1.2; }
.login-marca p { margin: 2px 0 0; color: var(--text2); font-size: 13px; }
.login-rodape { margin: 16px 0 0; text-align: center; color: var(--text3); font-size: 12px; }
.titulo-pagina { font-size: 18px; margin: 0 0 8px; }
.texto-apoio { color: var(--text2); margin: 0 0 14px; }

/* ------------------------------------------------------------------ páginas genéricas (admin) */
.pagina { padding: 16px; max-width: 1280px; margin: 0 auto; }
.pagina.estreita { max-width: 520px; padding-top: 40px; }
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 18px; }
.erro-cartao { text-align: center; }
.erro-codigo { font-size: 44px; font-weight: 700; color: var(--text3); margin: 0; }
.cab-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cab-pagina h1 { font-size: 20px; margin: 0; }
.cab-pagina p { margin: 2px 0 0; color: var(--text2); }

.tabela-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
table.tabela { width: 100%; border-collapse: collapse; }
table.tabela th {
  text-align: left; font-size: 11.5px; color: var(--text2); font-weight: 600; background: var(--surface2);
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tabela td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tabela tr:last-child td { border-bottom: 0; }
table.tabela td.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text3); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--surface2); color: var(--text2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag.azul { background: var(--primary-soft); color: var(--primary); }
.tag.verde { background: var(--ok-bg); color: var(--ok); }
.tag.vermelha { background: var(--late-bg); color: var(--late); }
.tag.amarela { background: var(--warn-bg); color: var(--warn); }
.tag.roxa { background: var(--pay-bg); color: var(--pay); }

.senha-gerada {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 22px; letter-spacing: 1px; font-weight: 700;
  background: var(--surface2); border: 1px dashed var(--text3); border-radius: 6px; padding: 12px 16px; display: inline-block; user-select: all;
}

/* seleção de nomes de vendedor(a) */
.nomes-lista { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.nome-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.nome-item:last-child { border-bottom: 0; }
.nome-item:hover { background: var(--surface2); }
.nome-item input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); }
.nome-item .nome-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nome-item small { color: var(--text2); }
.nome-item .outros { color: var(--warn); font-weight: 600; }
.busca-nomes { display: block; width: 100%; max-width: 360px; height: 32px; border: 1px solid #8a8886; border-radius: 4px; padding: 0 8px; margin-bottom: 6px; background: var(--surface); }
.grade-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 18px; }
.secao-form { margin-top: 18px; }
.secao-form h2 { font-size: 14px; margin: 0 0 4px; }
.secao-form p { margin: 0 0 8px; color: var(--text2); }
.linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }
.estado-lista { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; }
.estado-lista dt { color: var(--text2); font-weight: 600; }
.estado-lista dd { margin: 0; }

@media (max-width: 760px) {
  body { font-size: 14px; }
  .barra { gap: 8px; padding: 0 10px; }
  .marca span { display: none; }
  .conta-nome { display: none; }
  .pagina { padding: 12px; }
  .estado-lista { grid-template-columns: 1fr; }
}
