:root {
  --bg: #f4f2ef; --surface: #fff; --line: #e3ded7; --text: #17150f; --muted: #5b5650;
  --brand: #ff6600; --brand-text: #c24e00; --danger: #b42318; color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; padding-bottom: 90px; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.top { background: #000; color: #f4f4f4; position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: #b3b3b3; font-size: .75rem; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: #ccc; }
.who .btn { color: #fff; border-color: #333; background: #111; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #000; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn.danger { background: #fff; border-color: #f2c4bf; color: var(--danger); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn.big { min-height: 54px; font-size: 1.05rem; width: 100%; background: #fff; color: #222; border-color: #ddd; }

.login { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px 16px; }
.login-card { background: #0b0b0b; color: #eee; border-radius: 20px; padding: 36px 28px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.login-card img { margin: 0 auto 12px; }
.login-card p { color: #bbb; }
.login-card .msg { color: #ffb48a; min-height: 1.5em; margin-top: 14px; }
.login-card .fine { font-size: .8rem; color: #888; margin: 18px 0 0; }

.painel { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.tabs button { flex: 1; min-height: 42px; border: 0; background: none; border-radius: 8px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0 14px; }
.tabs button[aria-selected="true"] { background: #000; color: #fff; }
.aba-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.aba-head p { color: var(--muted); max-width: 70ch; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }

.form { display: grid; gap: 14px; max-width: 760px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
label small { font-weight: 500; color: var(--muted); }
input, textarea { font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { resize: vertical; }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.switch.sm { font-size: .88rem; }

.produtos { display: grid; gap: 14px; }
.produto { display: grid; gap: 16px; grid-template-columns: 1fr; margin: 0; }
.p-img { width: 100%; max-width: 140px; aspect-ratio: 1; border-radius: 10px; background: #f3efea; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.p-img img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.p-img span { color: #a39b91; font-size: .8rem; }
.p-campos { display: grid; gap: 12px; }
.linha2 { display: grid; gap: 12px; }
.p-acoes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.p-acoes .switch { margin-right: auto; }
@media (min-width: 760px) {
  .produto { grid-template-columns: 140px 1fr; }
  .p-acoes { grid-column: 1 / -1; }
  .linha2 { grid-template-columns: 1fr 1fr; }
}
.importar { border-color: #ffc59e; background: linear-gradient(120deg, #fff6ef, #fff); }
.importar p { color: var(--muted); }
.importar textarea { margin-bottom: 10px; }
.imp-acoes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.imp-msg { color: var(--brand-text); font-weight: 600; font-size: .92rem; }
.dica { margin-top: 14px; font-size: .93rem; }
.dica summary { cursor: pointer; font-weight: 700; }
.dica ol { padding-left: 20px; display: grid; gap: 8px; margin: 10px 0; }
.bookmarklet { cursor: grab; margin-left: 6px; }
.fine2 { font-size: .82rem; color: var(--muted); margin: 0; }
.produto.novo { outline: 3px solid var(--brand); animation: pisca 1.2s ease 2; }
@keyframes pisca { 50% { outline-color: transparent; } }
.vazio { text-align: center; padding: 40px; color: var(--muted); border: 2px dashed var(--line); border-radius: 14px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.kpi strong { display: block; font-size: 1.8rem; line-height: 1; }
.kpi span { color: var(--muted); font-size: .85rem; }
.tabela { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.savebar span { margin-right: auto; color: var(--muted); font-size: .9rem; }
.savebar.pendente { background: #fff6ef; border-top-color: #ffc59e; }
.savebar.pendente span { color: var(--brand-text); font-weight: 700; }
