:root {
  --bg: #f4f6f8;
  --card: #fff;
  --ink: #1c2430;
  --muted: #6b7785;
  --line: #e2e7ec;
  --brand: #0a7d5a;
  --brand-ink: #fff;
  --danger: #c0392b;
  --warn: #b8860b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1em; margin: 6px 0 0; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }

button {
  background: var(--brand); color: var(--brand-ink); border: 0;
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 14px;
}
button:hover { filter: brightness(1.05); }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { color: var(--ink); }
button.link { background: none; color: var(--brand); padding: 4px; }
input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 14px; background: #fff;
}

/* Login */
.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login .card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 6px; font-size: 22px; }
.login h1 span { color: var(--brand); }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px;
}
.card.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Formulario com rotulo acima de cada campo */
.form-grid { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span {
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.field > span .req { color: var(--danger); font-weight: 700; font-style: normal; }
.field.narrow input { width: 130px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }

/* Header */
header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
header nav { display: flex; gap: 4px; }
header nav button { background: transparent; color: var(--muted); padding: 6px 12px; }
header nav button.active { background: var(--bg); color: var(--ink); }
.badge {
  background: var(--danger); color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 12px; margin-left: 4px;
}

main { padding: 20px; max-width: 1100px; margin: 0 auto; }
.tab h2 { font-size: 17px; }

table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th {
  background: #fafbfc; color: var(--muted); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbfc; }

/* Alinhamento: cabecalho e valor sempre do mesmo lado */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.right, th.right { text-align: right; }

/* Celulas da tabela de produtos */
.sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; background: var(--bg); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.pname { font-weight: 500; }
.qty { font-weight: 700; font-size: 15px; }
.qty.low { color: var(--danger); }
.unit { color: var(--muted); font-size: 12px; margin-left: 3px; }
.dim { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }

/* Botao secundario pequeno (acoes de linha) */
.btn-sm {
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 5px 12px; border-radius: 7px; font-size: 13px; white-space: nowrap;
}
.btn-sm:hover { background: var(--bg); border-color: #cfd6dd; filter: none; }
.pill { padding: 2px 8px; border-radius: 20px; font-size: 12px; background: var(--bg); }
.pill.shortage { background: #fdecea; color: var(--danger); }
.pill.unknown_sku { background: #fff4e0; color: var(--warn); }
.pill.low_stock { background: #fff4e0; color: var(--warn); }
.pill.inactive_product { background: #fff4e0; color: var(--warn); }
.pill.no_deal, .pill.no_items { background: #eef; color: #556; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,28,38,.45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-card { width: 700px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.modal-card h4 { margin: 0 0 6px; }

/* Bloco do formulario dentro do modal */
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 14px 0 6px; }
.bm-toolbar { margin: 14px 0 8px; gap: 10px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.check input { width: auto; }

/* Lista longa: rola sozinha, com cabecalho fixo */
.table-scroll {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px;
}
.table-scroll table { border: 0; border-radius: 0; box-shadow: none; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; box-shadow: inset 0 -1px 0 var(--line); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
