:root {
  --ink: #1b2433;
  --muted: #6d7585;
  --line: #e7ebf2;
  --page: #f4f6f9;
  --card: #ffffff;
  --green: #1f9d55;
  --green-bar: #22a35a;
  --green-soft: #e8f7ee;
  --amber: #e09400;
  --amber-bar: #f0b429;
  --amber-soft: #fff6e0;
  --red: #e04848;
  --red-bar: #ef5b56;
  --red-soft: #fdecec;
  --neutral: #e6e9ef;
  --blue: #3b82f6;
  --blue-soft: #eef4ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }

.app { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.brand strong { font-size: 18px; letter-spacing: -0.02em; }
.brand .sep { width: 1px; height: 22px; background: var(--line); }
.brand .sub { color: var(--muted); font-size: 15px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.date-pill, .chip, .badge, .ghost, .export {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.date-pill { position: relative; }
.date-pill input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.date-pill .caret { color: var(--muted); font-size: 12px; }
.icon { display: inline-flex; flex: none; }
.badge.ok { background: var(--green-soft); color: var(--green); border-color: #cfeedd; font-weight: 600; }
.badge.warn { background: var(--amber-soft); color: #9a6800; border-color: #f3e0b0; font-weight: 600; }
.badge.pending { background: #f3f4f6; color: var(--muted); font-weight: 600; }

.content { padding: 22px 28px 40px; }
.cards { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 6px;
}
.info {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid #cfd5e0; color: var(--muted);
  font-size: 11px; display: inline-grid; place-items: center;
  background: #fff;
}
.bar {
  display: flex; height: 52px; border-radius: 8px; overflow: hidden; background: #eef1f6;
}
.bar button {
  border: 0; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; padding: 0 4px; line-height: 1.15; gap: 1px;
}
.bar button small { font-weight: 650; font-size: 12.5px; }
.bar .baixo { background: #1f9d57; }
.bar .medio { background: #f0a202; color: #3a2a00; }
.bar .alto { background: #e5484d; }
.counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  min-height: 22px;
}
.counts button {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  text-align: left;
}
.counts button strong { font-weight: 720; font-variant-numeric: tabular-nums; }
.counts .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.counts .baixo { background: var(--green-soft); color: var(--green); }
.counts .medio { background: var(--amber-soft); color: #9a6800; }
.counts .alto { background: var(--red-soft); color: var(--red); }
.counts .fora { background: #f3f4f6; color: var(--muted); }
.caption { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.big {
  border: 0; background: transparent; padding: 0; display: block; text-align: left;
  font-size: 64px; line-height: 0.95; font-weight: 720; letter-spacing: -0.04em; margin: 2px 0 8px;
}
.weg-actions { display: flex; gap: 8px; margin-top: 14px; }
.pill {
  border: 0; border-radius: 999px; padding: 6px 10px; font-weight: 650; font-size: 13px;
}
.pill.up { background: #fde8e8; color: var(--red); }
.pill.down { background: var(--green-soft); color: var(--green); }

.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 18px 0 10px; font-size: 14px; }
.crumbs button { border: 0; background: transparent; color: var(--muted); padding: 0; }
.crumbs button.here, .crumbs .here { color: var(--ink); font-weight: 650; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel h2 { margin: 0; padding: 16px 18px 8px; font-size: 16px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
td { padding: 11px 12px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.linkish, .twist, .catname {
  border: 0; background: transparent; padding: 0; text-align: left;
}
.catname { font-weight: 650; }
.catname:hover, .linkish:hover { text-decoration: underline; }
.baixo { color: var(--green); }
.medio { color: var(--amber); }
.alto { color: var(--red); }
.twist { width: 22px; color: var(--muted); }
.catcell { display: flex; align-items: center; gap: 4px; }
.leaf { color: var(--green); font-size: 14px; }
.footnote { color: var(--muted); font-size: 13px; padding: 12px 18px 16px; display: flex; gap: 8px; align-items: center; }
.delta { display: inline-flex; gap: 8px; }
.banner {
  background: #fff8e8; border: 1px solid #f3e0b0; color: #7a5410;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px;
}
.empty {
  padding: 48px 20px; text-align: center; color: var(--muted);
}
.sku-link { color: var(--blue); font-weight: 650; border: 0; background: transparent; padding: 0; }
tr.selected { background: #f3f7ff; }
tr.clicky { cursor: pointer; }
tr.clicky:hover { background: #fafbfd; }

.sidebar {
  width: 228px; background: #fff; border-right: 1px solid var(--line);
  padding: 18px 12px; flex: none;
}
.sidebar .logo { padding: 4px 10px 16px; }
.sidebar .logo strong { display: block; font-size: 16px; }
.sidebar .logo span { color: var(--muted); font-size: 13px; }
.nav-btn {
  width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 10px; padding: 9px 10px; color: #3c4658; display: flex; gap: 8px; align-items: center;
}
.nav-btn.active { background: var(--blue-soft); color: #2457c5; font-weight: 650; }
.nav-btn:disabled { color: #98a0ae; cursor: default; }
.side-foot { margin-top: 24px; }

.drill-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.drill-top .crumbs { margin-top: 0; }
h1.products { font-size: 28px; font-weight: 720; letter-spacing: -0.03em; margin: 14px 0 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.export { margin-left: 16px; flex: none; font-weight: 650; color: var(--ink); }
.pname-cell { max-width: 280px; }
.path-cell { max-width: 220px; color: #4b5568; font-size: 13px; }
td.money, th.money { white-space: nowrap; }
.chart { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.yaxis {
  flex: none; width: 92px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap;
}
.plot { flex: 1; min-width: 0; }
.xaxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.pager { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; }

.drawer {
  width: 360px; background: #fff; border-left: 1px solid var(--line);
  padding: 16px 16px 24px; flex: none; overflow: auto;
}
.drawer header { display: flex; justify-content: space-between; align-items: center; }
.drawer h2 { margin: 0; font-size: 16px; }
.drawer .x { border: 0; background: transparent; font-size: 20px; }
.drawer .sku { font-size: 22px; font-weight: 720; margin: 8px 0 2px; }
.drawer .pname { margin: 0 0 6px; }
.drawer .path { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.mini {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px;
}
.mini h3 { margin: 0; font-size: 13px; font-weight: 650; display: flex; gap: 6px; align-items: center; }
.mini .value { font-size: 22px; font-weight: 720; margin: 6px 0; }
.outline {
  width: 100%; margin-top: 8px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.badge-pos {
  border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 700;
}
.badge-pos.mais_baixo { background: var(--green-soft); color: var(--green); }
.badge-pos.intermediario { background: var(--amber-soft); color: #9a6800; }
.badge-pos.mais_alto { background: var(--red-soft); color: var(--red); }
.badge-pos.sem { background: #f3f4f6; color: var(--muted); }
.history { width: 100%; font-size: 12px; margin-top: 8px; }
.history td { padding: 4px 0; border: 0; }
.search {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: #fff; min-width: 180px;
}

@media (max-width: 1100px) {
  .cards { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .drawer { position: fixed; inset: 0 0 0 auto; z-index: 5; box-shadow: -8px 0 24px rgba(0,0,0,.08); }
  .big { font-size: 48px; }
}
@media (max-width: 720px) {
  .topbar, .content { padding-left: 14px; padding-right: 14px; }
  .brand .sub { display: none; }
  table { font-size: 13px; }
  .drawer { width: min(100%, 420px); }
}
