/* BNE Estoque · painel da equipe (celular primeiro)
   Paleta do kit oficial: azul #050096, laranja #FF5300. */
:root {
  color-scheme: light;
  --azul: #050096;
  --azul-escuro: #03006b;
  --azul-10: rgba(5, 0, 150, .08);
  --azul-25: rgba(5, 0, 150, .25);
  --laranja: #ff5300;
  --laranja-escuro: #d94700;
  --verde: #0f8a4b;
  --vermelho: #c62828;
  --tinta: #16161d;
  --tinta-2: #5b5b6b;
  --tinta-3: #8c8c9b;
  --fundo: #f1f1f5;
  --papel: #ffffff;
  --linha: #e3e3ea;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(5, 0, 150, .06), 0 8px 24px -12px rgba(5, 0, 150, .25);
  --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fonte-marca: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --topo-h: 56px;
  --abas-h: 64px;
  --seguro-topo: env(safe-area-inset-top, 0px);
  --seguro-base: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.4;
  color: var(--tinta);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

/* ── carregando ─────────────────────────────── */
.carregando {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--azul);
}
.carregando img { width: 120px; animation: pulsar 1.2s ease-in-out infinite; }
@keyframes pulsar { 50% { opacity: .45; } }

/* ── login ──────────────────────────────────── */
.tela-login {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: calc(24px + var(--seguro-topo)) 20px calc(24px + var(--seguro-base));
  background:
    linear-gradient(102deg, transparent 0 62%, rgba(255, 83, 0, .9) 62% 66%, transparent 66%),
    var(--azul);
}
.login-caixa {
  width: 100%; max-width: 380px;
  background: var(--papel); border-radius: 20px; padding: 28px 22px 22px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .5);
}
.login-logo {
  width: 132px; margin: -64px auto 10px; padding: 14px 18px;
  background: var(--azul); border-radius: 12px; transform: skewX(-12deg);
}
.login-sub {
  text-align: center; margin: 0 0 20px;
  font: italic 700 15px/1 var(--fonte-marca); text-transform: uppercase; letter-spacing: .04em;
  color: var(--azul);
}
.login-erro { min-height: 20px; margin: 4px 0 8px; color: var(--vermelho); font-size: 14px; }
.login-ajuda { margin: 14px 0 0; text-align: center; color: var(--tinta-3); font-size: 13px; }

/* ── campos ─────────────────────────────────── */
.campo { display: block; margin-bottom: 14px; }
.campo > span, .rotulo {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600; color: var(--tinta-2);
}
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--linha); border-radius: 12px; background: var(--papel);
  font-size: 16px; /* 16px evita o zoom automático do iPhone */
  outline: none; transition: border-color .15s;
}
.campo textarea { min-height: 96px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--azul); }
.campo .ajuda { display: block; margin-top: 6px; font-size: 12.5px; color: var(--tinta-3); }
.linha-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prefixo { position: relative; }
.prefixo::before {
  content: attr(data-prefixo); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--tinta-3); font-weight: 600; pointer-events: none;
}
.prefixo input { padding-left: 44px; }
.sufixo { position: relative; }
.sufixo::after {
  content: attr(data-sufixo); position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--tinta-3); font-weight: 600; pointer-events: none;
}

/* escolhas em pílula (câmbio, combustível, cor, opcionais) */
.pilulas { display: flex; flex-wrap: wrap; gap: 8px; }
.pilula {
  min-height: 40px; padding: 8px 14px;
  border: 1.5px solid var(--linha); border-radius: 999px; background: var(--papel);
  font-size: 14.5px; font-weight: 600; color: var(--tinta-2);
}
.pilula[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: #fff; }
.pilula-mais { border-style: dashed; color: var(--azul); }

.interruptor {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 10px 14px; margin-bottom: 14px;
  background: var(--papel); border: 1.5px solid var(--linha); border-radius: 12px;
  font-weight: 600;
}
.interruptor input { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: #cfcfd8; position: relative; transition: background .2s; flex: none; }
.interruptor input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.interruptor input:checked { background: var(--verde); }
.interruptor input:checked::after { transform: translateX(20px); }

/* ── botões ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px;
  border: 0; border-radius: 12px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-grande { width: 100%; min-height: 54px; font-size: 17px; }
.btn-laranja { background: var(--laranja); color: #fff; }
.btn-laranja:active { background: var(--laranja-escuro); }
.btn-azul { background: var(--azul); color: #fff; }
.btn-claro { background: var(--azul-10); color: var(--azul); }
.btn-linha { background: var(--papel); color: var(--azul); border: 1.5px solid var(--azul-25); }
.btn-perigo { background: #fdecec; color: var(--vermelho); }
.btn-whats { background: #1a9e55; color: #fff; }
.btn-whats:active { background: #158446; }
.barra-acoes .btn-vendido { flex: 0 0 auto; padding: 12px 16px; }
.msg-previa {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 12px 12px 12px 4px;
  background: #e5f8d9; color: #1b2a1b; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.btn-texto { background: none; color: var(--azul); padding: 8px 4px; min-height: 40px; }

/* ── topo e abas ────────────────────────────── */
.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: calc(var(--topo-h) + var(--seguro-topo)); padding: var(--seguro-topo) 14px 0;
  background: var(--azul); color: #fff;
}
.topo-logo { height: 20px; width: auto; flex: none; }
.topo-titulo {
  flex: 1; min-width: 0; margin: 0;
  font: italic 700 17px/1.1 var(--fonte-marca); text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topo-salvo { font-size: 12.5px; opacity: .85; white-space: nowrap; }
.topo-voltar { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; color: #fff; }
.topo-voltar svg, .abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topo.com-voltar .topo-logo { display: none; }

.abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; height: calc(var(--abas-h) + var(--seguro-base)); padding-bottom: var(--seguro-base);
  background: var(--papel); border-top: 1px solid var(--linha);
}
.abas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--tinta-3); text-decoration: none; font-size: 12px; font-weight: 600;
}
.abas a[aria-current="page"] { color: var(--azul); }

.conteudo { padding: 16px 16px calc(var(--abas-h) + var(--seguro-base) + 96px); max-width: 720px; margin: 0 auto; }
.conteudo.sem-abas { padding-bottom: calc(var(--seguro-base) + 120px); }

/* ── estoque ────────────────────────────────── */
.filtros { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros .pilula { flex: none; }
.filtros .pilula b { margin-left: 4px; opacity: .7; font-weight: 700; }
.busca { display: block; margin-bottom: 14px; }
.busca input { width: 100%; min-height: 46px; padding: 10px 14px 10px 42px; border: 1.5px solid var(--linha); border-radius: 12px; background: var(--papel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8c9b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 14px center / 20px; font-size: 16px; outline: none; }
.busca input:focus { border-color: var(--azul); }

.lista { display: grid; gap: 12px; }
.cartao {
  display: grid; grid-template-columns: 112px 1fr; gap: 12px;
  padding: 10px; border-radius: var(--raio); background: var(--papel); box-shadow: var(--sombra);
  color: inherit; text-decoration: none;
}
.cartao-foto { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--azul-10); color: var(--azul-25); display: grid; place-items: center; }
.cartao-foto img { width: 100%; height: 100%; object-fit: cover; }
.cartao-foto svg { width: 80%; }
.cartao-corpo { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cartao-titulo { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartao-sub { margin: 0; font-size: 13.5px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartao-preco { margin-top: auto; font-weight: 800; font-size: 16px; color: var(--azul); }
.cartao-rodape { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--tinta-3); }

.etiqueta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.etiqueta-rascunho { background: #fff4e5; color: #a35200; }
.etiqueta-publicado { background: #e6f6ed; color: var(--verde); }
.etiqueta-vendido { background: #ececf1; color: var(--tinta-2); }
.etiqueta-exemplo { background: var(--azul-10); color: var(--azul); }

.vazio { text-align: center; padding: 48px 16px; color: var(--tinta-2); }
.vazio svg { width: 160px; color: var(--azul-25); margin: 0 auto 12px; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--abas-h) + var(--seguro-base) + 16px); z-index: 15;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px;
  background: var(--laranja); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 10px 24px -8px rgba(255, 83, 0, .7);
}
.fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }

/* ── editor do veículo ──────────────────────── */
.resumo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.resumo .progresso { font-size: 13px; color: var(--tinta-2); }
.secao {
  margin-bottom: 16px; padding: 16px 14px;
  background: var(--papel); border-radius: var(--raio); box-shadow: var(--sombra);
}
.secao-titulo {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 0 0 12px;
  font: italic 700 16px/1.1 var(--fonte-marca); text-transform: uppercase; letter-spacing: .02em; color: var(--azul);
}
.secao-titulo small { font: 600 12.5px var(--fonte); text-transform: none; letter-spacing: 0; color: var(--tinta-3); }
.dica {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--azul-10); color: var(--azul); font-size: 13.5px;
}
.dica svg { flex: none; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foto-caixa {
  position: relative; display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden; background: #fafaff;
  border: 2px dashed var(--azul-25);
}
.foto-caixa.feita { border: 2px solid transparent; background: #000; }
.foto-caixa.capa { grid-column: 1 / -1; }
.foto-area { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; color: rgba(5, 0, 150, .32); border: 0; background: none; padding: 0; width: 100%; }
.foto-area svg { width: 70%; height: auto; margin-top: -8%; }
.foto-area img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.foto-obrigatoria {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  padding: 2px 6px; border-radius: 5px; background: var(--laranja); color: #fff;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.foto-rotulo {
  position: absolute; left: 8px; right: 8px; bottom: 6px; z-index: 2;
  font-size: 13px; font-weight: 700; line-height: 1.2; color: var(--azul); text-align: left;
}
.foto-rotulo small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--tinta-3); }
.foto-caixa.feita .foto-rotulo {
  top: 0; bottom: auto; left: 0; right: 0; padding: 8px 8px 18px;
  background: linear-gradient(rgba(0, 0, 0, .55), transparent); color: #fff;
}
.foto-caixa.capa .foto-rotulo { font-size: 15px; }
.foto-ok {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--verde); color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.foto-ok svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.foto-botoes { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; padding: 6px; }
.foto-caixa.feita .foto-botoes { display: none; }
.foto-botoes .btn { min-width: 0; min-height: 44px; padding: 8px; gap: 6px; font-size: 14px; border-radius: 10px; white-space: nowrap; }
.foto-botoes .btn-galeria { width: 44px; padding: 0; }
.foto-enviando {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center; align-content: center; gap: 8px;
  background: rgba(5, 0, 150, .72); color: #fff; font-size: 13px; font-weight: 700;
}
.giro { width: 30px; height: 30px; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.foto-erro { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; align-content: center; gap: 8px; padding: 10px; background: rgba(198, 40, 40, .9); color: #fff; font-size: 13px; font-weight: 700; text-align: center; }

.diferenca { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 8px; background: #e6f6ed; color: var(--verde); font-size: 13px; font-weight: 700; }
.diferenca.acima { background: #fdecec; color: var(--vermelho); }

.barra-acoes {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 18;
  display: flex; gap: 10px;
  padding: 12px 16px calc(12px + var(--seguro-base));
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--linha);
}
.barra-acoes .btn { flex: 1; }
.barra-acoes .btn-mais { flex: none; width: 54px; padding: 0; }

.historico { margin: 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--tinta-2); }
.historico li { padding: 8px 0; border-bottom: 1px solid var(--linha); }
.historico li:last-child { border-bottom: 0; }

/* ── equipe e conta ─────────────────────────── */
.pessoa { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--linha); }
.pessoa:last-child { border-bottom: 0; }
.pessoa-avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--azul); color: #fff; font-weight: 800; }
.pessoa.inativa .pessoa-avatar { background: #b9b9c6; }
.pessoa-info { flex: 1; min-width: 0; }
.pessoa-nome { margin: 0; font-weight: 700; }
.pessoa-email { margin: 0; font-size: 13px; color: var(--tinta-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pessoa .btn { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.credenciais { padding: 14px; border-radius: 12px; background: var(--azul-10); font-size: 15px; word-break: break-all; }
.credenciais b { color: var(--azul); }

/* ── folha (bottom sheet) e toast ───────────── */
.folha-fundo { position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 30, .45); animation: aparecer .15s ease-out; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-height: 88dvh; overflow-y: auto;
  padding: 10px 16px calc(18px + var(--seguro-base));
  background: var(--papel); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .25);
  animation: subir .2s ease-out;
}
.folha::before { content: ""; display: block; width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: #d6d6df; }
.folha h2 { margin: 0 0 6px; font-size: 19px; }
.folha p { margin: 0 0 14px; color: var(--tinta-2); }
.folha .opcoes { display: grid; gap: 8px; }
.folha .opcoes .btn { justify-content: flex-start; width: 100%; }
.folha ul.faltando { margin: 0 0 16px; padding-left: 20px; color: var(--tinta); }
.folha ul.faltando li { margin-bottom: 6px; }
@keyframes subir { from { transform: translateY(100%); } }
@keyframes aparecer { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--abas-h) + var(--seguro-base) + 84px); z-index: 60;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--tinta); color: #fff; font-size: 14.5px; font-weight: 600;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s;
}
.toast.mostrar { opacity: 1; transform: translate(-50%, 0); }
.toast.erro { background: var(--vermelho); }

.foto-cheia { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: #000; }
.foto-cheia img { max-width: 100%; max-height: 100%; object-fit: contain; }
.foto-cheia button { position: absolute; top: calc(12px + var(--seguro-topo)); right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .2); color: #fff; font-size: 24px; }

@media (min-width: 720px) {
  .fotos { grid-template-columns: 1fr 1fr 1fr; }
  .foto-caixa.capa { grid-column: span 2; grid-row: span 2; }
  .barra-acoes { justify-content: center; }
  .barra-acoes .btn { flex: 0 1 260px; }
}
