:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #2a241c;
  --muted: #8a8073;
  --line: #ece6da;
  --gold: #a07a3a;
  --gold-dark: #7d5b22;
  --gold-soft: #f6efe1;
  --ok: #2f7d4f;
  --bad: #b3372f;
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; font-size: 16px; } /* 16px evita o zoom automatico do iPhone */
img { max-width: 100%; }
[hidden] { display: none !important; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: 10px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- catalogo ---------- */
.hero { text-align: center; padding: 26px 16px 10px; }
.hero .logo { height: 150px; width: auto; display: inline-block; }
.hero p { margin: 8px 0 0; font-size: 11px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); }

.pdf-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--gold-dark); font-size: 13px; text-decoration: none; }
.pdf-link:hover { border-color: var(--gold); background: var(--gold-soft); }
.pdf-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.barra-topo { position: sticky; top: 0; z-index: 10; background: rgba(251, 250, 247, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.barra-in { display: flex; gap: 10px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.busca { position: relative; flex: 1; min-width: 0; }
.busca svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; pointer-events: none; }
.busca input { width: 100%; min-width: 0; height: 44px; padding: 0 16px 0 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); outline: none; }
.busca input:focus { border-color: var(--gold); }
.carrinho-btn { position: relative; height: 44px; padding: 0 16px; border-radius: 999px; flex-shrink: 0; }
.carrinho-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.carrinho-btn .rot { font-size: 14px; }
.carrinho-btn span.n { background: var(--gold); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; display: inline-grid; place-items: center; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; padding: 22px 0 70px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.2s, transform 0.2s; }
.card:hover { box-shadow: 0 10px 30px rgba(120, 90, 30, 0.12); transform: translateY(-2px); }
.card .foto { aspect-ratio: 1; background: #fff; display: grid; place-items: center; padding: 0; border-bottom: 1px solid var(--line); overflow: hidden; } /* a foto ja vem quadrada e com margem propria */
.card .foto img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.card .foto.vazia { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; background: var(--gold-soft); }
.card .info { padding: 14px 14px 4px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card .marca { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--gold); font-weight: 600; }
.card .nome { font-family: var(--serif); font-size: 19px; line-height: 1.15; font-weight: 600; }
.card .preco { font-family: var(--serif); font-weight: 700; color: var(--ink); margin-top: auto; padding-top: 8px; font-size: 22px; }
.card .aviso { font-size: 11.5px; color: var(--bad); }
.card .acoes { padding: 10px 14px 14px; }
.card .acoes .btn { width: 100%; height: 42px; background: transparent; color: var(--gold-dark); border-color: var(--gold); font-weight: 500; letter-spacing: 0.03em; }
.card .acoes .btn:hover:not(:disabled) { background: var(--gold); color: #fff; }
.vazio { text-align: center; color: var(--muted); padding: 60px 0; }

.fundo { position: fixed; inset: 0; background: rgba(30, 22, 8, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 20; }
.fundo.aberto { opacity: 1; pointer-events: auto; }
.gaveta { position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(420px, 100%); background: var(--bg); z-index: 21; transform: translateX(100%); transition: transform 0.25s; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18); visibility: hidden; }
.gaveta.aberta { transform: none; visibility: visible; }
.gaveta > header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.gaveta h2 { font-size: 24px; }
.gaveta .itens { flex: 1; overflow: auto; padding: 4px 16px; }
.item { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item img, .item .ph { width: 60px; height: 60px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.item .nome { font-family: var(--serif); font-size: 17px; line-height: 1.15; font-weight: 600; }
.item .sub { font-size: 12.5px; color: var(--muted); }
.qtd { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.qtd button { border: 0; background: none; width: 34px; height: 34px; font-size: 18px; color: var(--ink); }
.qtd button:disabled { opacity: 0.3; }
.qtd span { min-width: 22px; text-align: center; font-size: 14px; }
.gaveta footer { padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.gaveta footer input { height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; }
.gaveta footer input:focus { border-color: var(--gold); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--serif); font-size: 20px; }
.total strong { font-size: 26px; }
.btn.zap { background: #1fa855; border-color: #1fa855; color: #fff; height: 48px; font-weight: 600; }
.btn.zap:hover:not(:disabled) { background: #178a45; border-color: #178a45; }

@media (max-width: 640px) {
  .hero { padding-top: 18px; }
  .hero .logo { height: 118px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 16px; }
  .card .nome { font-size: 17px; }
  .card .preco { font-size: 20px; }
  .card .info { padding: 10px 10px 2px; }
  .card .acoes { padding: 8px 10px 12px; }
  .carrinho-btn .rot { display: none; }
  .carrinho-btn { padding: 0 14px; }
}

/* ---------- admin ---------- */
.login { max-width: 340px; margin: 10vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login img { height: 90px; margin: 0 auto 6px; }
.login input { height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.msg { color: var(--bad); font-size: 14px; min-height: 1.2em; }

.admin-topo { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-topo .wrap { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.admin-topo .marca { display: flex; align-items: center; gap: 8px; margin-right: auto; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.admin-topo .marca img { height: 30px; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); }
.tab.ativa { background: var(--gold-soft); color: var(--gold-dark); font-weight: 600; }
.admin-main { padding: 20px 16px 60px; max-width: 1200px; margin: 0 auto; }
.admin-main h2 { font-size: 26px; margin-bottom: 14px; }
.barra { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.barra h2 { margin: 0; }
.barra .grow { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi small { color: var(--muted); display: block; font-size: 12px; }
.kpi strong { font-family: var(--serif); font-size: 26px; }
.kpi.pos strong { color: var(--ok); }

.tabela { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--bg); }
th:first-child, td:first-child, td.esq, th.esq { text-align: left; }
tr:last-child td { border-bottom: 0; }
td img { width: 40px; height: 40px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 6px; vertical-align: middle; }
.ph40 { width: 40px; height: 40px; background: var(--gold-soft); border-radius: 6px; flex-shrink: 0; }
td img { flex-shrink: 0; }
.prodnome { display: flex; gap: 10px; align-items: center; text-align: left; }
.prodnome small { display: block; color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.acoes-td { display: flex; gap: 6px; justify-content: flex-end; }

.lotes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.lote { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lote header { display: flex; justify-content: space-between; align-items: start; gap: 8px; flex-wrap: wrap; }
.lote h3 { font-size: 22px; }
.lote small { color: var(--muted); }
.lote ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.lote li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); gap: 8px; }
.lote li button { border: 0; background: none; color: var(--bad); padding: 0 6px; font-size: 18px; }
.lote .linha { display: flex; justify-content: space-between; font-size: 14px; gap: 8px; }
.lote .linha.forte { font-weight: 600; }
.lote form { display: flex; gap: 6px; }
.lote form input { min-width: 0; height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.lote form input[name=descricao] { flex: 1; }
.lote form input[name=valor] { width: 90px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); padding: 0; width: min(640px, calc(100% - 20px)); max-height: 92vh; max-height: 92dvh; }
dialog::backdrop { background: rgba(30, 22, 8, 0.5); }
dialog form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
dialog h3 { font-size: 24px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.campos .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label input, label select, label textarea { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
label input:focus, label select:focus, label textarea:focus { outline: none; border-color: var(--gold); }
.rodape { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.foto-box { display: flex; gap: 12px; align-items: center; }
.foto-box .prev { width: 96px; height: 96px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: #fff; color: var(--muted); font-size: 12px; text-align: center; flex-shrink: 0; }
.foto-box .prev img { width: 100%; height: 100%; object-fit: contain; }
.foto-box .col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.resultados { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.resultados button { border: 2px solid var(--line); border-radius: 10px; padding: 0; background: #fff; aspect-ratio: 1; overflow: hidden; }
.resultados button:hover { border-color: var(--gold); }
.resultados img { width: 100%; height: 100%; object-fit: contain; }
.sug { background: var(--gold-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.sug .linha { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sug .forte { font-weight: 600; font-size: 15px; }
@media (max-width: 520px) { .campos { grid-template-columns: 1fr; } .admin-main h2 { font-size: 22px; } }

/* tabela de perfumes compacta em telas medias, para caber sem rolar para o lado */
@media (min-width: 1101px) {
  .admin-main { max-width: 1500px; }
  #tabProdutos { font-size: 13px; }
  #tabProdutos th, #tabProdutos td { padding: 8px 6px; white-space: normal; }
  #tabProdutos td:not(:first-child):not(:last-child) { white-space: nowrap; }
  #tabProdutos th { font-size: 10px; letter-spacing: 0.03em; }
  #tabProdutos td:first-child { min-width: 170px; }
  #tabProdutos td img, #tabProdutos .ph40 { width: 34px; height: 34px; }
  #tabProdutos .acoes-td { flex-wrap: wrap; justify-content: flex-end; min-width: 90px; max-width: 150px; margin-left: auto; }
}

/* tabela de perfumes vira lista de cartoes em telas menores */
@media (max-width: 1100px) {
  .tabela { border: 0; background: none; overflow: visible; }
  #tabProdutos thead { display: none; }
  #tabProdutos, #tabProdutos tbody { display: block; }
  #tabProdutos tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; padding: 6px 12px; }
  #tabProdutos td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; white-space: normal; text-align: right; border-bottom: 1px dashed var(--line); }
  #tabProdutos td:first-child { display: block; text-align: left; padding: 8px 0 10px; }
  #tabProdutos td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; }
  #tabProdutos td:last-child { border-bottom: 0; padding-top: 10px; }
  #tabProdutos .acoes-td { width: 100%; }
  #tabProdutos .acoes-td .btn { flex: 1; padding: 9px 6px; }
}
