:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #1d2327;
  --muted: #667075;
  --line: #e4e0d6;
  --side: #10393b;
  --side-ink: #cfe2df;
  --accent: #d9603b;
  --accent-ink: #ffffff;
  --ok: #1f7a4d;
  --ok-bg: #e5f4ec;
  --warn: #9a6200;
  --warn-bg: #fdf1d8;
  --err: #b42318;
  --err-bg: #fde8e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 1px 1px rgba(16, 24, 32, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: #0f6b6e; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; font-size: 16px; padding: 4px 8px 22px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 15px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side form { position: absolute; bottom: 18px; left: 14px; right: 14px; }
.side .logout { width: 100%; background: transparent; border: 1px solid rgba(255,255,255,.18); color: var(--side-ink); }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; }

/* componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.btn, button { font: inherit; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover, button:hover { border-color: #c9c3b5; text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover, button.primary:hover { filter: brightness(.96); }
.btn.sm, button.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger, button.danger { color: var(--err); }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #faf9f5; }
tr:last-child td { border-bottom: 0; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eee; border: 1px solid var(--line); display: block; }
.t-title { font-weight: 600; max-width: 460px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.pf-shopee { background: #fff0eb; color: #c2410c; border-color: #fbd3c4; }
.pf-mercadolivre { background: #fff9c9; color: #6b5a00; border-color: #efe28a; }
.pf-tiktok { background: #eef1f3; color: #111; border-color: #d5dadd; }
.st-publicado, .st-concluido { background: var(--ok-bg); color: var(--ok); }
.st-importado { background: #e8f0fb; color: #1d4f91; }
.st-pendente, .st-na_fila, .st-rodando { background: var(--warn-bg); color: var(--warn); }
.st-erro, .st-falhou { background: var(--err-bg); color: var(--err); }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #b9e2cb; }
.flash.erro { background: var(--err-bg); color: var(--err); border-color: #f6c3bd; }

form.stack label, .field { display: block; margin-bottom: 14px; }
label .lbl, .field .lbl { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.req { color: var(--accent); }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #d6d0c3; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #f2b29e; border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { padding: 6px 12px; border-radius: 999px; background: #ebe7dd; color: var(--muted); font-size: 13px; font-weight: 600; }
.step.on { background: var(--side); color: #fff; }
.step.done { background: #d7e8e3; color: var(--side); }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fff; cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice input { margin-top: 4px; }
.log { font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 520px; overflow: auto; }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.log .bad { color: var(--err); }
.log .good { color: var(--ok); }
.progress { height: 10px; background: #ebe7dd; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.sticky-bar { position: sticky; bottom: 0; background: var(--side); color: #fff; padding: 12px 16px; border-radius: 10px; margin-top: 14px; display: none; }
.sticky-bar.show { display: flex; }
.sticky-bar select { width: auto; min-width: 220px; }
.prod-head { display: flex; gap: 14px; align-items: center; }
.prod-head img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
code { background: #f0ede4; padding: 2px 6px; border-radius: 5px; font-size: 13px; word-break: break-all; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .g-main { grid-template-columns: 1fr !important; }
  .side { position: static; height: auto; padding: 12px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; }
  .side form { position: static; margin-top: 8px; }
  .brand { padding-bottom: 10px; }
  .main { padding: 18px 16px 50px; }
  .g4, .g3, .g2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }
