/* Amanda Brossmann · Etiquetas — baseado no design-system (tokens em design-system/design-tokens.json) */
:root {
  --bg: rgb(250, 250, 250);
  --surface: rgb(255, 255, 255);
  --soft: rgb(240, 241, 243);
  --line: rgb(232, 234, 237);
  --ink: rgb(4, 17, 31);
  --ink-2: rgb(19, 17, 55);
  --muted: rgb(91, 95, 99);
  --muted-2: rgb(113, 120, 128);
  --accent: rgb(69, 19, 235);
  --accent-soft: rgba(69, 19, 235, 0.08);
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --warn: #a15c00;
  --warn-soft: #fff3e0;
  --danger: #c4302b;
  --danger-soft: #fdecea;

  --radius-card: 20px;
  --radius-md: 11px;
  --radius-sm: 7px;
  --radius-pill: 50px;

  --shadow-md: rgba(147, 145, 171, 0.13) 0px 5px 10px 0px;
  --shadow-lg: rgba(0, 0, 0, 0.17) 0px 0.6px 1.57px -1.5px, rgba(0, 0, 0, 0.14) 0px 2.29px 5.95px -3px, rgba(0, 0, 0, 0.02) 0px 10px 26px -4.5px;
  --ease: cubic-bezier(.2, .7, .3, 1);

  --font: "Inter", "Geist", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1152px; margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0 8px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }

.nav { display: inline-flex; gap: 2px; padding: 4px; background: var(--soft); border-radius: var(--radius-pill); }
.nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a.ativo { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md); }
.nav .contador {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-grid; place-items: center;
}

.topbar-acoes { display: flex; align-items: center; gap: 10px; }
.link-sair { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 4px; }
.link-sair:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero h1 { font-size: 40px; line-height: 44px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 10px; }
.hero p { margin: 0; color: var(--muted); font-size: 16px; max-width: 520px; }
.hero-acoes { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 0;
  font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primario { background: var(--ink); color: rgb(250, 250, 250); }
.btn-primario:hover { background: var(--ink-2); }
.btn-secundario { background: var(--soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-secundario:hover { background: var(--line); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-fantasma { background: transparent; color: var(--muted); }
.btn-fantasma:hover { background: var(--soft); color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.girando svg { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--soft); color: var(--muted); text-decoration: none;
}
a.chip:hover { filter: brightness(.97); }
.chip .ponto { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-aviso { background: var(--warn-soft); color: var(--warn); }
.chip-erro { background: var(--danger-soft); color: var(--danger); }
.chip-sync { cursor: default; }
.chip-sync.rodando .ponto { animation: pulsar 1s ease-in-out infinite; }
@keyframes pulsar { 50% { opacity: .25; } }

.tag-grade { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--soft); color: var(--muted); font-size: 12px; margin: 2px 4px 2px 0; }
.sku { font-family: var(--mono); font-size: 12.5px; color: var(--ink); letter-spacing: -0.01em; }

/* ---------- Cards de resumo ---------- */
.stats { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-lg); }
.stat { padding: 22px 24px; display: flex; flex-direction: column; gap: 6px; }
.stat-rotulo { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.stat-valor { font-size: 32px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.stat-sub { color: var(--muted); font-size: 13px; }

.stat-destaque {
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff; padding: 24px 28px; border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 14px;
}
.stat-destaque .stat-rotulo { color: rgba(255, 255, 255, .55); }
.stat-destaque .stat-valor { font-size: 40px; }
.stat-destaque .stat-valor small { font-size: 14px; color: rgba(255, 255, 255, .55); font-weight: 400; margin-left: 6px; letter-spacing: 0; }
.barra { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7b5cff, #b7a6ff); transition: width .6s var(--ease); }
.destaque-linha { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-top: 4px; }
.destaque-linha div { display: flex; flex-direction: column; gap: 2px; }
.destaque-linha b { font-weight: 600; font-size: 15px; }
.destaque-linha span { font-size: 11px; color: rgba(255, 255, 255, .55); text-transform: uppercase; letter-spacing: .06em; }
.destaque-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.btn-claro { background: #fff; color: var(--ink); }
.btn-claro:hover { background: rgb(240, 241, 243); }

/* ---------- Toolbar da lista ---------- */
.painel { padding: 8px; margin-bottom: 40px; }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 12px 16px; }
.busca { position: relative; flex: 1 1 320px; max-width: 460px; }
.busca svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); pointer-events: none; }
.input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--bg); font-size: 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-soft); }
.busca .input { padding-left: 40px; }
.segmentado { display: inline-flex; gap: 2px; padding: 4px; background: var(--soft); border-radius: var(--radius-pill); }
.segmentado a { padding: 7px 14px; border-radius: var(--radius-pill); text-decoration: none; color: var(--muted); font-weight: 500; font-size: 13px; }
.segmentado a.ativo { background: #fff; color: var(--ink); box-shadow: var(--shadow-md); }
.contagem { color: var(--muted); font-size: 13px; padding: 0 12px 12px; }

/* ---------- Tabela ---------- */
.tabela-wrap { overflow-x: auto; }
.tabela { width: 100%; border-collapse: separate; border-spacing: 0; }
.tabela th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabela td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tbody tr { transition: background .15s; }
.tabela tbody tr:hover { background: var(--bg); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela .acoes { text-align: right; white-space: nowrap; }
.produto-nome { font-weight: 500; }
.produto-data { color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.preco-antigo { color: var(--muted-2); text-decoration: line-through; font-size: 12px; margin-right: 6px; }

.vazio { padding: 64px 24px; text-align: center; color: var(--muted); }
.vazio h3 { color: var(--ink); font-size: 20px; font-weight: 600; margin: 0 0 6px; }

.paginacao { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 12px 8px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.paginacao .botoes { display: flex; gap: 8px; }

/* ---------- SKU ---------- */
.sku-topo { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 20px 24px; margin-bottom: 16px; }
.sku-topo p { margin: 4px 0 0; color: var(--muted); }
.progresso { display: none; margin-top: 14px; }
.progresso.ativo { display: block; }
.progresso .barra { background: var(--soft); height: 8px; }
.progresso .barra > span { background: var(--ink); }
.progresso-texto { font-size: 13px; color: var(--muted); margin-top: 8px; }

.lista-sku { display: flex; flex-direction: column; gap: 12px; margin-bottom: 48px; }
.item-sku { overflow: hidden; transition: box-shadow .2s; }
.item-sku-cab {
  display: flex; align-items: center; gap: 16px; padding: 18px 24px; cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left;
}
.item-sku-cab:hover { background: var(--bg); }
.item-sku-info { flex: 1; min-width: 0; }
.item-sku-info .produto-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seta { width: 18px; height: 18px; color: var(--muted-2); transition: transform .25s var(--ease); flex: none; }
.item-sku.aberto .seta { transform: rotate(180deg); }
.item-sku-corpo { display: none; padding: 4px 24px 24px; border-top: 1px solid var(--line); }
.item-sku.aberto .item-sku-corpo { display: block; animation: surgir .25s var(--ease); }
.item-sku.salvo { opacity: .55; }
@keyframes surgir { from { opacity: 0; transform: translateY(-4px); } }

.campo { display: flex; flex-direction: column; gap: 6px; margin: 18px 0 8px; max-width: 380px; }
.campo label, .rotulo { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.input-sku { font-family: var(--mono); font-size: 13px; border-radius: var(--radius-md); height: 38px; text-transform: uppercase; }
.input-sku.alterado { border-color: var(--accent); background: #fff; }
.input-sku.invalido { border-color: var(--danger); background: var(--danger-soft); }
.tabela-sku td { padding: 10px 12px; }
.tabela-sku th { padding: 10px 12px; }
.tabela-sku .input-sku { min-width: 240px; }
.item-sku-rodape { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.mensagem { font-size: 13px; white-space: pre-line; margin-right: auto; }
.mensagem.erro { color: var(--danger); }
.mensagem.ok { color: var(--ok); }
.carregando { padding: 28px 0; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--ink); animation: girar .8s linear infinite; }

/* ---------- Histórico ---------- */
.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 48px; }
.card-titulo { font-size: 20px; line-height: 24px; font-weight: 600; margin: 0; padding: 22px 24px 8px; }

/* ---------- Modal ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--radius-card); width: min(440px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(4, 17, 31, .25); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(4, 17, 31, .35); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: surgir .25s var(--ease); }
.modal-corpo { padding: 28px; }
.modal-corpo h3 { font-size: 20px; line-height: 24px; font-weight: 600; margin: 0 0 4px; }
.modal-corpo .stat-sub { margin: 0 0 20px; }
.modal-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: var(--bg); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 20px; }
.modal-info b { display: block; font-size: 15px; font-weight: 600; margin-top: 2px; }
.qtd { display: flex; align-items: center; gap: 8px; }
.qtd .input { text-align: center; font-size: 18px; font-weight: 600; height: 48px; border-radius: var(--radius-md); }
.qtd .btn { width: 48px; height: 48px; padding: 0; font-size: 20px; border-radius: var(--radius-md); }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.dica { font-size: 12px; color: var(--muted-2); margin-top: 8px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px;
  box-shadow: var(--shadow-lg); max-width: 380px; animation: surgir .25s var(--ease); white-space: pre-line;
}
.toast.erro { background: var(--danger); }

/* ---------- Login ---------- */
.login-pagina { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; padding: 40px 36px; }
.login-card .logo { display: block; width: 210px; max-width: 70%; margin: 0 auto 28px; }
.login-card h1 { font-size: 20px; line-height: 24px; font-weight: 600; text-align: center; margin: 0 0 4px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 28px; }
.login-card .campo { max-width: none; margin: 0 0 14px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.alerta { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 13px; }

.rodape { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--muted-2); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-destaque { grid-column: 1 / -1; }
  .grade-2 { grid-template-columns: 1fr; }
}
@media (max-width: 809px) {
  .container { padding: 0 16px; }
  .topbar { flex-wrap: wrap; padding-top: 20px; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .nav a { flex: 1; justify-content: center; padding: 8px 6px; font-size: 13px; }
  .so-desktop { display: none; }
  .nav a { white-space: nowrap; }
  .stat-destaque .stat-valor small { display: block; margin: 6px 0 0; }
  .hero { padding: 28px 0 24px; }
  .hero h1 { font-size: 32px; line-height: 36px; }
  .hero-acoes, .hero-acoes .btn { width: 100%; }
  .hero-acoes .btn { flex: 1; }
  .stats { grid-template-columns: 1fr; }
  .busca { max-width: none; }
  .segmentado { width: 100%; }
  .segmentado a { flex: 1; text-align: center; }

  /* tabela vira cartões */
  .tabela-itens thead { display: none; }
  .tabela-itens, .tabela-itens tbody, .tabela-itens tr, .tabela-itens td { display: block; width: 100%; }
  .tabela-itens tr { padding: 14px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
  .tabela-itens td { padding: 0; border: 0; }
  .tabela-itens td.col-produto { grid-column: 1 / -1; }
  .tabela-itens td.num { text-align: left; }
  .tabela-itens td.acoes { grid-column: 1 / -1; }
  .tabela-itens td.acoes .btn { width: 100%; }

  .tabela-sku .input-sku { min-width: 0; }
  .item-sku-cab, .item-sku-corpo { padding-left: 16px; padding-right: 16px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
}
