@font-face {
  font-family: "Montserrat";
  src: url("fonts/montserrat-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --blue: #1557d6;
  --blue-dark: #0c3a96;
  --blue-deep: #0a2a66;
  --blue-soft: #eaf1fe;
  --ink: #101a2e;
  --ink-2: #47536b;
  --ink-3: #7a8499;
  --line: #e2e7f0;
  --bg: #ffffff;
  --bg-2: #f6f8fc;
  --red: #c62828;
  --red-soft: #fdecec;
  --green: #17794a;
  --green-soft: #e6f5ed;
  --amber: #8a5a00;
  --amber-soft: #fff3d6;
  --side-w: 248px;
  --side-w-min: 68px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 14px/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
h3 { font-size: 15px; margin-bottom: 4px; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.93em; }
code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; }
.small { font-size: 12.5px; }
.muted { color: var(--ink-3); }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Estrutura */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.shell.collapsed { grid-template-columns: var(--side-w-min) minmax(0, 1fr); }
.side {
  background: var(--blue-deep); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden auto;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 14px 14px 18px; }
.brand { color: #fff; font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand strong { font-weight: 800; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: #6ea4ff; box-shadow: 0 0 0 4px rgba(110, 164, 255, .25); flex: none; }
.side-toggle { background: none; border: 0; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; line-height: 0; }
.side-toggle:hover { background: rgba(255, 255, 255, .12); }
.side svg, .top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; flex: 1; }
.nav a, .side-foot a, .side-foot button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: #cfdcf7; font: inherit; font-weight: 600; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; white-space: nowrap;
}
.nav a:hover, .side-foot a:hover, .side-foot button:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav a.on, .side-foot a.on { background: var(--blue); color: #fff; }
.side-foot { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
.side-foot small { display: block; font-weight: 500; font-size: 11.5px; color: #9fb6e6; }
.side-foot .lbl { overflow: hidden; text-overflow: ellipsis; }
.shell.collapsed .lbl { display: none; }
.shell.collapsed .side-head { flex-direction: column; padding: 16px 0 8px; }
.shell.collapsed .nav a, .shell.collapsed .side-foot a, .shell.collapsed .side-foot button { justify-content: center; padding: 10px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top h1 { font-size: 20px; flex: 1; min-width: 180px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 22px 28px 48px; max-width: 1400px; width: 100%; }
.mobile-only { display: none; color: var(--ink); }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin: 28px 0 12px; }
.sec:first-child { margin-top: 0; }
.note { color: var(--ink-2); font-size: 13px; margin-top: 10px; max-width: 70ch; }
.hint { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }

/* Botoes e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9c4d8; text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger { color: var(--red); border-color: #efc2c2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 11px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--ink); padding: 8px 10px; border: 1px solid #cfd6e3; border-radius: 8px; background: #fff; min-width: 0; width: 100%;
}
input[type="checkbox"] { width: auto; }
input[type="file"] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
::placeholder { color: #a3acbd; }
.field-err { color: var(--red); font-weight: 600; }

/* Cartoes, formularios */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: #fff; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; max-width: 860px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row > label { flex: 1 1 150px; }
.form-row > .grow { flex: 2 1 240px; }
.span-all { flex: 1 1 100%; margin: 0; }
.form-narrow { max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; }
td .inline-form { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters label { flex: 0 1 170px; }
.filters .grow { flex: 2 1 240px; }
.filters .check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 9px; flex: none; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }

/* Avisos e estados */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; }
.alert-ok { background: var(--green-soft); color: var(--green); }
.alert-err { background: var(--red-soft); color: var(--red); }
.alert-warn { background: var(--amber-soft); color: var(--amber); }
.empty { border: 1px dashed #cfd6e3; border-radius: var(--radius); padding: 26px 22px; color: var(--ink-2); background: var(--bg-2); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
.empty p:last-child { margin-bottom: 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-err { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge-muted { background: #eef1f6; color: var(--ink-2); }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); background: #fff; }
a.kpi:hover { border-color: var(--blue); text-decoration: none; }
.kpi-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value.sm { font-size: 19px; }
.kpi-value .muted { font-size: 14px; font-weight: 600; letter-spacing: 0; }
.kpi-hint { font-size: 12px; color: var(--ink-3); min-height: 1em; }
.kpi-warn { border-color: #f0d28a; background: #fffaf0; }
.kpi-warn .kpi-value { color: var(--amber); }

/* Tabelas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); background: var(--bg-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfe; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.mono { white-space: nowrap; }
.tbl .sub { display: block; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.col-img { width: 52px; }
.col-img img, .noimg { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; display: block; background: var(--bg-2); border: 1px solid var(--line); }
.row-void td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: #c5ccd9; }
.row-void td:last-child { text-decoration: none; }
.checks td { padding: 7px 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.pager-nav { display: flex; gap: 10px; align-items: center; }
details.void { display: inline-block; margin-left: 8px; }
details.void summary { cursor: pointer; color: var(--red); font-size: 12.5px; font-weight: 600; }
details.void form { display: flex; gap: 6px; margin-top: 6px; min-width: 240px; }

/* Ficha do produto */
.prod-head { display: flex; gap: 20px; align-items: flex-start; }
.prod-head > div { flex: 1; min-width: 0; }
.prod-img { width: 112px; height: 112px; border-radius: 10px; flex: none; }
.sku-big { font-size: 16px; font-weight: 700; color: var(--blue-dark); }
.badges { display: flex; gap: 6px; margin: 6px 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 24px; margin: 0; }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; }
.facts dd { margin: 0; font-weight: 600; }

/* Login e instalacao */
body.bare { background: var(--bg-2); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px 16px; }
.brand-mark { display: flex; align-items: center; gap: 10px; font-size: 18px; color: var(--blue-deep); }
.brand-mark strong { font-weight: 800; }
.brand-mark .brand-dot { background: var(--blue); box-shadow: 0 0 0 4px rgba(21, 87, 214, .18); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 26px; }
.auth-card h1, .setup-card h1 { font-size: 20px; }
.setup-card { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 14px; }
.setup-step { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }

@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); transform: translateX(-100%); transition: transform .18s ease; z-index: 20; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 20, 45, .45); }
  .shell.collapsed .lbl { display: revert; }
  .shell.collapsed .side-head { flex-direction: row; padding: 18px 14px 14px 18px; }
  .shell.collapsed .nav a, .shell.collapsed .side-foot a, .shell.collapsed .side-foot button { justify-content: flex-start; padding: 10px 12px; }
  .mobile-only { display: inline-flex; }
  .top { padding: 14px 16px; }
  .content { padding: 16px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .prod-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .shell, .side { transition: none; }
}
