:root {
  --ink: #333333;
  --muted: #666666;
  --paper: #f0f2f5;
  --panel: #ffffff;
  --line: #d5dbe3;
  --accent: #0097b9;
  --accent-hover: #007a96;
  --accent-ink: #00657c;
  --accent-soft: rgba(0, 151, 185, 0.12);
  --rail: #eef1f4;
  --rail-ink: #333333;
  --rail-muted: #6b7280;
  --rail-hover: rgba(0, 151, 185, 0.10);
  --rail-active: #0097b9;
  --rail-line: #d5dbe3;
  --rail-w: 248px;
  --rail-w-collapsed: 64px;
  --ready: #0097b9;
  --study: #8a4b12;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font-ui: "Inter", "Segoe UI", Arial, sans-serif;
  --font-display: "Inter", "Segoe UI", Arial, sans-serif;
  --fw-menu: 450;
  --fw-menu-strong: 500;
  --fs-xs: 0.75rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.4rem;
  /* Pedido de Compra = referência de browse/edição */
  --fs-browse: 0.84rem;
  --fs-browse-head: 0.74rem;
  --fs-edit: 0.85rem;
  --fs-edit-label: 0.75rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}

body {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

body.rail-collapsed {
  grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr);
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mapa-rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 7px 10px;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--rail-line);
  width: var(--rail-w);
  transition: width 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 50;
}

.mapa-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 4px 8px;
  flex-shrink: 0;
}

.brand-mark {
  width: 100%;
  max-width: 200px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  padding: 4px 8px;
  flex-shrink: 1;
  min-width: 0;
  box-sizing: border-box;
}

.brand-mark img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.rail-toggle {
  appearance: none;
  border: 1px solid var(--rail-line);
  background: #fff;
  color: var(--rail-ink);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.rail-toggle:hover {
  background: var(--rail-hover);
  border-color: rgba(148, 163, 184, 0.55);
}

.rail-toggle-ico {
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform 0.2s ease;
}

body.rail-collapsed .rail-toggle-ico {
  transform: rotate(180deg);
}

body.rail-collapsed .mapa-rail {
  width: var(--rail-w-collapsed);
  padding-left: 6px;
  padding-right: 6px;
}

/* Hover no menu recolhido: abre por cima sem empurrar o conteúdo */
body.rail-collapsed .mapa-rail:hover,
body.rail-collapsed .mapa-rail.is-peek {
  width: var(--rail-w);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  box-shadow: 12px 0 28px rgba(15, 23, 42, 0.14);
  padding-left: 7px;
  padding-right: 7px;
}

body.rail-collapsed.rail-icons-only .mapa-rail .acc-label,
body.rail-collapsed.rail-icons-only .mapa-rail .chev,
body.rail-collapsed.rail-icons-only .mapa-rail .badge,
body.rail-collapsed.rail-icons-only .mapa-rail .menu-search,
body.rail-collapsed.rail-icons-only .mapa-rail .rail-legend,
body.rail-collapsed.rail-icons-only .mapa-rail .acc-children,
body.rail-collapsed.rail-icons-only .mapa-rail .brand-mark {
  display: none !important;
}

body.rail-collapsed.rail-icons-only .mapa-brand {
  justify-content: center;
  padding: 4px 0 6px;
}

body.rail-collapsed.rail-icons-only .acc-mod-btn {
  justify-content: center;
  padding: 10px 6px;
}

body.rail-collapsed.rail-icons-only .acc-mod-btn .acc-ico-mod {
  margin: 0;
}

.menu-search {
  display: block;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}

.menu-search input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--rail-ink);
  background: #fff;
  border: 1px solid var(--rail-line);
  border-radius: 7px;
  padding: 6px 9px;
  appearance: none;
  -webkit-appearance: none;
}

.menu-search input::placeholder {
  color: #9aa3ad;
}

/* Chrome/Edge: botão de resultados / stepper nativo ignora overflow e vaza no menu */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none !important;
  appearance: none;
  -webkit-appearance: none;
}

input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="datetime-local"]::-webkit-inner-spin-button,
input[type="month"]::-webkit-inner-spin-button,
input[type="week"]::-webkit-inner-spin-button,
input[type="time"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button,
input[type="datetime-local"]::-webkit-clear-button {
  display: none;
  -webkit-appearance: none;
}

/* Peek do menu cobre a área de conteúdo; cromo nativo (data/busca) pinta por cima do aside */
body.rail-collapsed .mapa-rail:hover ~ .shell input[type="date"]::-webkit-calendar-picker-indicator,
body.rail-collapsed .mapa-rail.is-peek ~ .shell input[type="date"]::-webkit-calendar-picker-indicator,
body.rail-collapsed .mapa-rail:hover ~ .shell input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.rail-collapsed .mapa-rail.is-peek ~ .shell input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.mapa-rail,
.menu-flyout {
  font-family: var(--font-ui);
  font-weight: 400;
  font-synthesis: none;
}

.acc-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 4px;
}

.acc-mod {
  border-radius: 7px;
}

.acc-mod.is-open,
.acc-mod.is-flyout,
.acc-mod.is-current {
  background: rgba(0, 151, 185, 0.08);
}

.acc-mod-btn {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--rail-ink);
  font: inherit;
  font-weight: var(--fw-menu-strong);
  font-size: var(--fs-md);
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  line-height: 1.3;
}

.acc-mod-btn .acc-label {
  flex: 1;
  min-width: 0;
}

.acc-mod-btn:hover,
.acc-mod.is-open > .acc-mod-btn,
.acc-mod.is-flyout > .acc-mod-btn,
.acc-mod.is-current > .acc-mod-btn {
  background: var(--rail-hover);
}

.acc-mod-btn .chev {
  font-size: 0.65rem;
  opacity: 0.65;
  color: var(--rail-muted);
  transition: transform 0.15s ease;
  margin-left: auto;
}

.acc-mod.is-open > .acc-mod-btn .chev {
  transform: none;
  color: var(--accent);
  opacity: 1;
}
.acc-mod.is-flyout > .acc-mod-btn .chev {
  color: var(--accent);
  opacity: 1;
}

.acc-children {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 0 0 5px 7px;
}

.acc-mod.is-open > .acc-children {
  display: none;
}

.mapa-rail > .acc-menu .acc-children {
  display: none !important;
}

.acc-heading {
  margin: 8px 4px 2px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: var(--fw-menu-strong);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rail-muted);
  opacity: 0.9;
}

.acc-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 2px 0 4px;
}

.acc-group-btn {
  appearance: none;
  border: 0;
  background: rgba(148, 163, 184, 0.1);
  color: var(--rail-ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-menu);
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.acc-group-btn .acc-label {
  flex: 1;
  min-width: 0;
}

.acc-group-btn .chev {
  display: inline-block;
  transition: transform 0.15s ease;
  opacity: 0.7;
}

.acc-group.is-open > .acc-group-btn .chev {
  transform: rotate(90deg);
}

.acc-group-btn:hover {
  background: var(--rail-hover);
}

.acc-group-children {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 2px 0 4px 8px;
  border-left: 2px solid var(--rail-line);
  margin-left: 8px;
}

.acc-group.is-open > .acc-group-children {
  display: flex;
}

.acc-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--rail-ink);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  padding: 7px 10px 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 7px;
  border-left: 2px solid transparent;
  line-height: 1.35;
}

.acc-item .acc-label {
  flex: 1;
  min-width: 0;
}

.acc-item:hover {
  background: var(--rail-hover);
}

.acc-item.is-active {
  background: var(--rail-active);
  border-left-color: var(--accent-hover);
  color: #fff;
  font-weight: var(--fw-menu-strong);
}

.acc-item .badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #b45309;
  flex-shrink: 0;
}

.acc-item .badge.ready {
  color: var(--accent);
}

.acc-item .badge.blocked {
  color: #94a3b8;
}

.acc-item.is-blocked {
  opacity: 0.55;
}

.acc-item.is-blocked:hover {
  opacity: 0.75;
}

.acc-ico-mod {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--rail-ink);
  background: transparent;
  opacity: 0.9;
}

.acc-ico-mod svg {
  width: 100%;
  height: 100%;
  display: block;
}

.acc-mod-btn:hover .acc-ico-mod,
.acc-mod.is-open > .acc-mod-btn .acc-ico-mod,
.acc-mod.is-flyout > .acc-mod-btn .acc-ico-mod,
.acc-mod.is-current > .acc-mod-btn .acc-ico-mod {
  color: var(--accent);
  opacity: 1;
}

.menu-flyout-root[hidden] {
  display: none !important;
}
.menu-flyout-root {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: none;
}
.menu-flyout-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(15, 23, 42, 0.18);
}
.menu-flyout-panels {
  position: fixed;
  inset: 0;
  z-index: 410;
  pointer-events: none;
}
.menu-flyout {
  pointer-events: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(280px, 86vw);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px 12px;
  background: var(--rail);
  color: var(--rail-ink);
  border-right: 1px solid var(--rail-line);
  box-shadow: 12px 0 28px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}
.menu-flyout-head {
  flex-shrink: 0;
  padding: 8px 10px 10px;
  font-size: 0.78rem;
  font-weight: var(--fw-menu-strong);
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  border-bottom: 1px solid var(--rail-line);
}
.menu-flyout-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 2px 4px;
}
.menu-flyout .acc-group-btn.is-flyout-open {
  background: var(--rail-active);
  color: #fff;
}
.menu-flyout .acc-group-btn .chev {
  transform: none;
}
body.menu-flyout-open .mapa-rail {
  z-index: 420;
}
body.menu-flyout-open.rail-collapsed {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}
body.menu-flyout-open.rail-collapsed .mapa-rail,
body.menu-flyout-open.rail-collapsed .mapa-rail.is-peek {
  width: var(--rail-w);
  position: relative;
  box-shadow: none;
  padding-left: 7px;
  padding-right: 7px;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .acc-label,
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .menu-search,
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .rail-legend {
  display: block !important;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .brand-mark {
  display: flex !important;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .chev,
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-rail .badge {
  display: inline-flex !important;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .mapa-brand {
  justify-content: flex-start;
  padding: 10px 8px 8px;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .acc-mod-btn {
  justify-content: flex-start;
  padding: 8px 10px;
}
body.menu-flyout-open.rail-collapsed.rail-icons-only .acc-mod-btn .acc-ico-mod {
  margin-right: 8px;
}

.rail-legend {
  margin-top: 0;
  flex-shrink: 0;
  padding-top: 8px;
  border-top: 1px solid var(--rail-line);
  color: var(--rail-muted);
  font-size: var(--fs-xs);
}

.shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  padding: 5px 16px;
  min-height: 0;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar .eyebrow {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar h1,
.stage h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  letter-spacing: -0.02em;
}

.topbar h1 {
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-meta {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
}

.pill {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(0, 151, 185, 0.22);
  white-space: nowrap;
}

.pill.muted {
  background: rgba(93, 107, 117, 0.12);
  color: var(--muted);
  border-color: rgba(93, 107, 117, 0.2);
}

.loja-switch {
  position: relative;
}

.loja-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 151, 185, 0.35);
  background: #fff;
  color: var(--ink, #1c2830);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}

.loja-switch-btn[hidden] {
  display: none;
}

.loja-switch-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loja-switch-btn::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
}

.loja-switch-btn.is-single {
  cursor: default;
}

.loja-switch-btn.is-single::after {
  display: none;
}

.loja-switch-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 80;
  width: 320px;
  max-height: min(420px, 70vh);
  overflow: auto;
  background: #fff;
  border: 1px solid #c5ced6;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(20, 32, 42, 0.22);
}

.loja-switch-head {
  padding: 8px 12px;
  background: #2b2b2b;
  color: #fff;
  font-size: var(--fs-sm, 13px);
  font-weight: 600;
}

.loja-switch-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.loja-switch-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm, 13px);
  cursor: pointer;
}

.loja-switch-list button:hover {
  background: #e8f6fa;
}

.loja-switch-list button.is-current {
  background: #1a73c7;
  color: #fff;
}

.ws-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 12px;
  min-width: 0;
  background: var(--accent);
  border-bottom: 1px solid var(--accent-hover);
  min-height: 40px;
  position: relative;
  z-index: 50;
}

.ws-tabs[hidden] {
  display: none !important;
}

.ws-tabs-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  padding: 4px 0;
}

.ws-tab {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  max-width: 220px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px 4px 0 0;
  color: #ffffff;
  position: relative;
}

.ws-tab:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ws-tab.is-active {
  background: #f4f7fb;
  color: #1a3a55;
  box-shadow: 0 -1px 0 #f4f7fb;
}

.ws-tab-main {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  min-width: 36px;
  min-height: 32px;
}

.ws-tab.is-active .ws-tab-main {
  padding-right: 4px;
}

.ws-tab-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.ws-tab-icon svg {
  width: 100%;
  height: 100%;
}

.ws-tab-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-menu-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.ws-tab:not(.is-active) .ws-tab-label {
  max-width: 110px;
  color: #ffffff;
  font-weight: var(--fw-menu-strong);
  text-shadow: 0 1px 1px rgba(0, 55, 68, 0.45);
}
.ws-tab:not(.is-active) .ws-tab-close {
  color: rgba(255, 255, 255, 0.85);
}
.ws-tab:not(.is-active) .ws-tab-close:hover {
  color: #ffd7d3;
}

.lookup-vinculo-novo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line, #ccd);
  background: #f7fafc;
}
.lookup-vinculo-novo-bar.hidden {
  display: none !important;
}
.lookup-vinculo-novo-bar .form-note {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.82rem;
}

.ws-tab-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5a738a;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 8px 0 2px;
  align-self: center;
}

.ws-tab-close:hover {
  color: #b42318;
}

.modules {
  display: flex;
  gap: 4px;
  padding: 0 20px 8px;
  overflow-x: auto;
}

.mod-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: var(--fw-menu-strong);
  font-size: var(--fs-sm);
  padding: 7px 11px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mod-btn:hover { color: var(--ink); background: rgba(255, 253, 248, 0.55); }

.mod-btn.is-active {
  color: var(--accent-ink);
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  padding: 0 20px 20px;
  min-height: 0;
  flex: 1;
}

.sidecar {
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  box-shadow: var(--shadow);
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow: auto;
}

.sidecar-label {
  margin: 0 6px 8px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.side-item {
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--ink);
}

.side-item:hover { background: rgba(15, 107, 92, 0.08); }

.side-item.is-active {
  background: rgba(15, 107, 92, 0.14);
  font-weight: 600;
}

.side-item .badge {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--study);
}

.side-item .badge.ready { color: var(--ready); }

.stage {
  background: rgba(255, 253, 248, 0.85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 20px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.stage:has(#viewCadastro.is-pedido-ficha:not(.hidden)),
.stage:has(#viewCadastro.is-nfe-entrada:not(.hidden)),
.stage:has(#viewCadastro.is-nfe-entrada-vinculo:not(.hidden)),
.stage:has(#viewCadastro.has-produto-browse:not(.hidden)) {
  overflow: hidden;
  padding: 8px 12px 10px;
  margin-bottom: 10px;
}

.lead {
  margin: 6px 0 12px;
  color: var(--muted);
  max-width: 58ch;
  line-height: 1.45;
  font-size: var(--fs-base);
}

.legend {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot.ready { background: var(--ready); }
.dot.study { background: var(--study); }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.home-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: var(--fs-base);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 107, 92, 0.45);
}

.home-card strong { display: block; margin-bottom: 4px; font-size: var(--fs-md); }
.home-card span { font-size: var(--fs-sm); color: var(--muted); }

.placeholder-card {
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: var(--fs-base);
}

.placeholder-card .small { font-size: var(--fs-sm); margin-top: 8px; }

.cad-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.cad-head .eyebrow {
  margin: 0 0 2px;
}

.cad-head h2 {
  margin: 0;
}

.cad-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
}

#viewCadastro .btn {
  font-size: var(--fs-edit);
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--paper);
  color: var(--ink);
}

.btn.btn-new {
  background: var(--accent-hover);
  color: #fff;
}

.btn.btn-new:hover {
  background: var(--accent-ink);
}

.btn.btn-excluir {
  background: #b91c1c;
  color: #fff;
  border: 0;
  font-weight: 650;
}

.btn.btn-excluir:hover {
  background: #991b1b;
}

.cad-search-panel,
.cad-list-panel,
.cad-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.cad-search-panel {
  padding: 12px 14px 8px;
  margin-bottom: 12px;
}

.cad-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.os-list-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.os-list-filters.hidden {
  display: none;
}

.os-list-filter {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted, #5a6570);
}

.os-list-filter select {
  font: inherit;
  font-size: var(--fs-edit);
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 11rem;
}

.os-list-filter-consultor select {
  min-width: 14rem;
  max-width: 22rem;
}

.col-os-status {
  white-space: nowrap;
}

.os-diag-field.os-diag-vazio textarea {
  border-color: #d64545;
  background: #fff6f6;
  box-shadow: inset 3px 0 0 #d64545;
}

.os-diag-field.os-diag-ok textarea {
  border-color: #2a9d4b;
  background: #f4fbf6;
  box-shadow: inset 3px 0 0 #2a9d4b;
}

.nfe-bola-azul { background: #2f6fed; }
.nfe-bola-cinza { background: #8a8f98; }

.cad-toolbar input {
  flex: 1;
  font: inherit;
  font-size: var(--fs-edit);
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
}

.dbf-chip {
  display: none;
}

.cad-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

#viewCadastro.is-opening {
  position: relative;
}
#viewCadastro.is-opening::after {
  content: 'Carregando…';
  position: absolute;
  left: 0;
  right: 0;
  top: 72px;
  bottom: 0;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.cad-list-panel {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cad-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

/* .ped-cab label { display:flex !important } ganha de .hidden — OS vazava e espremia Cliente/Rep */
.ped-cab label.hidden,
.ped-os-field.hidden,
.ped-os-status-field.hidden,
.ped-os-col.hidden {
  display: none !important;
}

.cad-list-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.table-wrap:focus {
  outline: 2px solid rgba(30, 79, 122, 0.35);
  outline-offset: -2px;
}

#viewCadastro.has-produto-browse {
  --pb-fs: var(--fs-browse);
  --pb-row-pad-y: 4px;
  --pb-lh: 1.2;
  --pb-row: calc(var(--pb-fs) * var(--pb-lh) + var(--pb-row-pad-y) * 2 + 1px);
}

#viewCadastro.cad-mode-list.has-produto-browse .table-wrap {
  /* Cabeçalho + ~12 linhas visíveis; o espaço extra vai para o detalhe */
  flex: 0 1 calc(var(--pb-row) * 13);
  height: calc(var(--pb-row) * 13);
  max-height: calc(var(--pb-row) * 13);
  min-height: calc(var(--pb-row) * 10);
}

#viewCadastro.has-produto-browse .cad-list-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px 6px;
  min-height: 0;
}

#viewCadastro.has-produto-browse .status-line {
  padding: 0 10px;
  font-size: 12px;
  line-height: 1.2;
  min-height: 0;
}

#viewCadastro.has-produto-browse .cad-list-head {
  display: none; /* título/hint redundantes — libera altura para os dois quadros */
}

#viewCadastro.has-produto-browse .cad-head {
  margin-bottom: 0;
  min-height: 0;
  padding-bottom: 0;
}

#viewCadastro.has-produto-browse .cad-head .eyebrow {
  display: none;
}

#viewCadastro.has-produto-browse .cad-head h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.12;
}

#viewCadastro.has-produto-browse .cad-search-panel {
  padding: 4px 8px;
  margin-bottom: 2px;
  border-radius: 8px;
  flex-shrink: 0;
}

#viewCadastro.has-produto-browse .produto-filters {
  gap: 4px 8px;
  align-items: center;
}

#viewCadastro.has-produto-browse .produto-filter {
  gap: 0;
}

#viewCadastro.has-produto-browse .produto-filter span {
  display: none; /* ganha altura — placeholder indica o campo */
}

#viewCadastro.has-produto-browse .produto-filter input {
  padding: 3px 8px;
  min-height: 26px;
  height: 26px;
  min-width: 90px;
  border-radius: 6px;
  font-size: var(--fs-edit);
  line-height: 1.2;
}

#viewCadastro.has-produto-browse .produto-filter-desc {
  flex: 1 1 180px;
}

#viewCadastro.has-produto-browse #btnFiltroProdPesquisar {
  height: 26px;
  padding: 0 10px;
  margin: 0;
  font-size: var(--fs-edit);
  line-height: 1;
  border-radius: 6px;
}

#viewCadastro.has-produto-browse #produtoFilters .dbf-chip {
  padding: 4px 8px;
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  align-self: center;
}

#viewCadastro.has-produto-browse .table-wrap table th,
#viewCadastro.has-produto-browse .table-wrap table td {
  padding: var(--pb-row-pad-y) 10px;
  font-size: var(--pb-fs);
  line-height: var(--pb-lh);
}

#viewCadastro.cad-mode-list.has-produto-browse .produto-browse-detail {
  flex: 1 1 auto;
  padding: 5px 8px 6px;
  gap: 4px;
  border-radius: 8px;
  box-shadow: none;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

#viewCadastro.has-produto-browse.is-browse-detail-collapsed .produto-browse-detail {
  flex: 0 0 auto;
  max-height: none;
}

#viewCadastro.cad-mode-list.has-produto-browse.is-browse-detail-collapsed .table-wrap {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: calc(var(--pb-row) * 8);
}

#viewCadastro.has-produto-browse.is-browse-detail-collapsed .produto-browse-detail-body {
  display: none;
}

#viewCadastro.has-produto-browse .produto-browse-detail-top {
  gap: 8px;
  min-height: 0;
  flex-shrink: 0;
  margin: 0;
}

#viewCadastro.has-produto-browse .produto-browse-detail-head {
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.15;
}

#viewCadastro.has-produto-browse .produto-browse-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#viewCadastro.has-produto-browse #btnProdutoBrowseToggleDetail,
#viewCadastro.has-produto-browse #btnProdutoLojas {
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  line-height: 1;
  border-radius: 5px;
  white-space: nowrap;
}

#viewCadastro.has-produto-browse .produto-browse-detail-body {
  min-height: 0;
  overflow: hidden; /* quadro inferior sem rolagem */
  flex: 1 1 auto;
}

#viewCadastro.has-produto-browse .produto-browse-text {
  padding: 6px 8px;
  font-size: var(--fs-browse);
  line-height: 1.35;
  max-height: none;
  border-radius: 8px;
}

#viewCadastro.has-produto-browse .produto-browse-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(210px, 0.9fr);
  gap: 5px 8px;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  align-items: stretch;
}

@media (max-height: 820px) {
  #viewCadastro.cad-mode-list.has-produto-browse .table-wrap {
    height: calc(var(--pb-row) * 11);
    max-height: calc(var(--pb-row) * 11);
  }
}

@media (max-width: 900px) {
  #viewCadastro.has-produto-browse .produto-browse-summary {
    grid-template-columns: 1fr 1fr;
  }
}

.produto-browse-summary .pb-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 5px 8px 6px;
  min-width: 0;
  height: 100%;
}

.produto-browse-summary .pb-block h5 {
  margin: 0 0 3px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
}

.produto-browse-summary .pb-compra.has-data {
  background: #eef6ff;
  border-color: #bfd3ea;
}

.produto-browse-summary .pb-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px 10px;
}

.produto-browse-summary .pb-compra .pb-kv-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 1280px) {
  .produto-browse-summary .pb-kv-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.produto-browse-summary .pb-kv {
  display: grid;
  grid-template-columns: 5.8rem minmax(0, 1fr);
  gap: 2px 6px;
  font-size: 0.8rem;
  line-height: 1.22;
  align-items: baseline;
}

.produto-browse-summary .pb-k {
  color: #64748b;
  font-weight: 600;
}

.produto-browse-summary .pb-v {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  word-break: normal;
}

.produto-browse-summary .pb-precos {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed #dbe3ee;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px 8px;
}

.produto-browse-summary .pb-obs {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.produto-browse-summary .pb-empty-compra {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
}

tbody tr.is-selectable {
  cursor: pointer;
}

tbody tr.is-selected {
  background: var(--accent-soft);
}

tbody tr.is-selected:hover {
  background: rgba(0, 151, 185, 0.18);
}

.produto-browse-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px 14px;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.produto-browse-detail.hidden {
  display: none !important;
}

.produto-browse-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.produto-browse-detail-head {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.produto-browse-detail-body {
  margin: 0;
  color: var(--ink);
}

.produto-browse-empty {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-browse);
}

.produto-browse-text {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f7fafc;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: var(--fs-browse);
  line-height: 1.55;
  color: #1a2f40;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 160px;
}

.produto-lojas-dialog {
  width: min(920px, 96vw);
  max-height: min(80vh, 720px);
}

.lookup-dialog.produto-lojas-dialog {
  width: min(980px, 96vw);
  max-width: 980px;
}

.lookup-overlay.ped-analise-overlay {
  z-index: 80;
  overflow: auto;
  align-items: start;
  justify-items: center;
  padding: 12px;
}

.lookup-dialog.ped-analise-dialog {
  width: min(1180px, 98vw);
  max-width: 1180px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  margin: auto;
}

.ped-analise-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.produto-lojas-modal-body {
  margin-top: 8px;
  overflow: auto;
  max-height: min(58vh, 520px);
}

.produto-browse-lojas-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
  background: #fff;
}

.produto-browse-lojas {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin: 0;
}

.produto-browse-lojas th,
.produto-browse-lojas td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.produto-browse-lojas th {
  background: #eef3f8;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a738a;
  position: sticky;
  top: 0;
  z-index: 1;
}

.produto-browse-lojas tr:last-child td {
  border-bottom: 0;
}

.produto-browse-lojas .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 5.5rem;
}

.produto-browse-lojas .col-loja {
  font-weight: 700;
  color: #1e4f7a;
}

.produto-browse-lojas .col-nome {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.produto-browse-lojas .is-matriz .col-loja::after {
  content: " matriz";
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #c27803;
  margin-left: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-browse);
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: var(--fs-browse-head);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: #5d6b75;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  cursor: default;
  transition: background 0.15s ease;
}

tbody tr:nth-child(even) {
  background: #f7f9fb;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.row-open {
  appearance: none;
  border: 0;
  background: transparent;
  color: #1a5f96;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.row-open.row-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #1a5f96;
}

.row-open.row-edit .ico-edit {
  width: 16px;
  height: 16px;
  display: block;
}

.row-open:hover {
  color: #0d2a44;
}

.row-open.row-edit:hover {
  background: var(--accent-soft);
  color: #0d2a44;
}

.row-open.row-edit:focus-visible {
  outline: 2px solid #1a5f96;
  outline-offset: 1px;
}

td.col-action {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

td.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-ok { color: var(--ready); font-weight: 600; }
.status-off { color: #8f1d1d; font-weight: 600; }

/* Valor de t?tulo em atraso (ABE + vencimento < hoje) */
td.valor-atraso {
  color: #dc2626;
  font-weight: 700;
}

/* Lista ? ficha: uma tela por vez */
#viewCadastro.cad-mode-list .cad-only-form { display: none !important; }
#viewCadastro.cad-mode-form .cad-only-list { display: none !important; }
#viewCadastro.cad-mode-form .cad-form { display: flex; }

/* Lançamento de título (receber/pagar): ESC ao lado de + Novo na lista */
#viewCadastro.cad-mode-list.show-esc-on-list #btnVoltarLista {
  display: inline-block !important;
}

/* Lista: cabe?alho/busca fixos; s? a grade rola */
#viewCadastro.cad-mode-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#viewCadastro.hidden {
  display: none !important;
}

#viewCadastro.cad-mode-list .cad-head,
#viewCadastro.cad-mode-list .status-line,
#viewCadastro.cad-mode-list .cad-search-panel,
#viewCadastro.cad-mode-list .titulo-resumo-bar {
  flex-shrink: 0;
}

#viewCadastro.cad-mode-list .cad-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#viewCadastro.cad-mode-list .cad-list-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#viewCadastro.cad-mode-list .table-wrap {
  flex: 1;
  min-height: 140px;
  max-height: none;
  overflow: auto;
}

.cad-form {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.cad-form-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cad-form-head h3 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.cad-form-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.cad-form-fields {
  display: grid;
  gap: 14px;
}

.form-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 12px;
}

.form-section h4 {
  margin: 0;
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.empresa-logo-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empresa-logo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.empresa-logo-preview-wrap {
  width: 120px;
  height: 120px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.empresa-logo-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.empresa-logo-empty {
  font-size: 0.8rem;
  color: #888;
}
.empresa-logo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.empresa-logo-actions input[type='file'] {
  max-width: 260px;
  font-size: 0.85rem;
}

.empresa-pdv-panel {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empresa-pdv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.empresa-pdv-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.empresa-pdv-slot {
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}
.empresa-pdv-slot.is-ativo {
  border-color: #3a8f5a;
  background: #f3faf5;
}
.empresa-pdv-slot.is-bloqueado {
  border-color: #c45c5c;
  background: #fdf4f4;
}
.empresa-pdv-slot header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.empresa-pdv-caixa {
  font-size: 0.85rem;
  color: var(--muted, #666);
}
.empresa-pdv-badge {
  margin-left: auto;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8e8e8;
}
.empresa-pdv-slot.is-ativo .empresa-pdv-badge {
  background: #d4edda;
  color: #1e6b3a;
}
.empresa-pdv-slot.is-bloqueado .empresa-pdv-badge {
  background: #f8d7da;
  color: #8a1f2a;
}
.empresa-pdv-slot-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.empresa-pdv-chave-input {
  min-width: 220px;
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
}
.empresa-pdv-chave {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
}
.empresa-pdv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.os-foto-preview-wrap {
  width: 180px;
  height: 140px;
}
.os-foto-gallery {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 96px;
}
.os-foto-empty {
  width: 100%;
  padding: 18px 12px;
  border: 1px dashed var(--line, #ccd);
  border-radius: 8px;
  background: #fafafa;
  color: #888;
  font-size: 0.85rem;
  text-align: center;
}
.os-foto-card {
  margin: 0;
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.os-foto-thumb {
  appearance: none;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  padding: 0;
  width: 132px;
  height: 100px;
  overflow: hidden;
  background: #f4f4f4;
  cursor: zoom-in;
}
.os-foto-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.os-foto-del {
  appearance: none;
  border: 1px solid var(--line, #ccd);
  background: #fff;
  border-radius: 4px;
  font: inherit;
  font-size: 0.75rem;
  padding: 4px 6px;
  cursor: pointer;
}
.os-foto-actions {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.os-foto-action-btns {
  display: flex;
  gap: 8px;
}
.cad-form label.is-wide-field {
  grid-column: 1 / -1;
}
.cad-form textarea {
  font: inherit;
  font-size: var(--fs-edit);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #faf7f1;
  min-height: 140px;
  width: 100%;
  resize: vertical;
  line-height: 1.4;
}

.cad-layout.is-clientes .form-section {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.cad-form label {
  display: grid;
  gap: 3px;
  font-size: var(--fs-edit-label);
  color: var(--muted);
}

.cad-form input,
.cad-form select {
  font: inherit;
  font-size: var(--fs-edit);
  color: var(--ink);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #faf7f1;
}

.cad-form input.is-auto-codigo,
.cad-form input[readonly] {
  background: #eef2f7;
  color: #4a5568;
  cursor: default;
}

.cad-form select { background: #fff; }

.cad-form select:disabled {
  background: #eef2f7;
  color: #4a5568;
  cursor: default;
}

#viewCadastro.os-ficha-readonly .btn-lookup {
  pointer-events: none;
  opacity: 0.4;
}

#viewCadastro.os-ficha-readonly .os-foto-actions,
#viewCadastro.os-ficha-readonly .os-foto-del {
  display: none;
}

.field-hint {
  font-size: 0.68rem;
  color: var(--muted);
}

.cad-form label.has-lookup {
  grid-column: span 1;
}

.lookup-input-wrap {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.lookup-input-wrap input {
  flex: 1;
  min-width: 0;
}

.btn-lookup {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.btn-lookup:hover {
  background: #f3efe6;
  border-color: #1a5f96;
}

.lookup-desc {
  font-size: var(--fs-xs);
  color: var(--muted);
  min-height: 1em;
}

.lookup-desc.is-ok {
  color: var(--ready);
}

.lookup-desc.is-error {
  color: #8f1d1d;
  font-weight: 600;
}

.lookup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 32, 39, 0.35);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 16px;
}

.lookup-overlay.hidden { display: none; }

.lookup-dialog {
  width: min(520px, 100%);
  max-height: min(70vh, 640px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lookup-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.lookup-dialog-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.lookup-search {
  font: inherit;
  font-size: var(--fs-sm);
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
}

.lookup-list {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7f1;
  min-height: 160px;
  max-height: 48vh;
}

.lookup-item {
  width: 100%;
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: baseline;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.lookup-item:hover {
  background: rgba(15, 107, 92, 0.08);
}

.lookup-item strong {
  color: #1a5f96;
  min-width: 3.5rem;
}

.lookup-item span {
  color: var(--muted);
}

.lookup-dialog.is-wide {
  width: min(640px, 100%);
}

.lookup-dialog.is-wide.is-browse {
  width: min(980px, 96vw);
  max-height: min(86vh, 820px);
}

.lookup-dialog.is-browse .lookup-list {
  max-height: min(62vh, 560px);
  background: #fff;
  padding: 0;
}

.lookup-browse-wrap {
  overflow: auto;
  max-height: inherit;
}

.lookup-browse {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-browse);
}

.lookup-browse thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f4;
  border-bottom: 1px solid #c5ced6;
  border-right: 1px solid #d5dde4;
  padding: 7px 8px;
  text-align: left;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #445;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.lookup-browse thead th:last-child {
  border-right: none;
}

.lookup-browse thead th.n,
.lookup-browse td.n {
  text-align: right;
}

.lookup-browse thead th.c,
.lookup-browse td.c {
  text-align: center;
}

.lookup-browse tbody td {
  border-bottom: 1px solid #ece7df;
  border-right: 1px solid #e3e9ee;
  padding: 6px 8px;
  vertical-align: top;
  white-space: nowrap;
}

.lookup-browse tbody td:last-child {
  border-right: none;
}

.lookup-browse td.desc {
  white-space: normal;
  min-width: 160px;
  max-width: 280px;
}

.lookup-browse td.ean,
.lookup-browse td.sku {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.lookup-browse-row {
  cursor: pointer;
}

.lookup-browse-row:hover,
.lookup-browse-row:focus {
  background: rgba(15, 107, 92, 0.1);
  outline: none;
}

.lookup-browse td.vcto-atraso {
  color: #dc2626;
  font-weight: 700;
}

.lookup-browse-hint {
  margin: 6px 10px 8px;
}

.lookup-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.lookup-dialog-foot.hidden {
  display: none;
}

.lookup-item.is-check {
  align-items: center;
  cursor: pointer;
}

.lookup-item.is-check input {
  width: 16px;
  height: 16px;
  accent-color: #0f6b5c;
  flex-shrink: 0;
}

.lookup-item.is-check .lookup-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lookup-item.is-check .lookup-item-meta small {
  color: var(--muted);
  font-size: var(--fs-xs, 0.75rem);
}

.contrato-emp-panel .menu-access-actions {
  margin-bottom: 8px;
}

.contrato-emp-selected {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7f1;
  min-height: 72px;
  max-height: 240px;
  overflow: auto;
}

.contrato-emp-empty {
  margin: 0;
  padding: 14px 12px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.contrato-emp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.contrato-emp-row:last-child {
  border-bottom: 0;
}

.contrato-emp-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contrato-emp-row-main strong {
  color: #1a5f96;
}

.contrato-emp-row-main span {
  color: var(--ink);
}

.contrato-emp-row-main small {
  color: var(--muted);
}

.contrato-emp-matriz {
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 4px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #0f5132;
  background: #d1e7dd;
}

.form-section.is-tab-hidden,
.form-section[hidden] {
  display: none !important;
}

/* Abas de produto só na ficha de produtos — nunca em lista ou outras telas */
#viewCadastro:not(.is-produtos-form) #produtoTabsBar,
#viewCadastro:not(.is-produtos-form) .produto-tabs,
#viewCadastro.cad-mode-list #produtoTabsBar,
#viewCadastro.cad-mode-list .produto-tabs {
  display: none !important;
}

.produto-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.produto-tabs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.produto-tabs-actions {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: stretch;
  margin-left: auto;
}

.produto-tabs-actions .btn {
  min-width: 5.5rem;
}

.btn.btn-revisa {
  background: #2e7d32;
  color: #fff;
  border-color: #1b5e20;
}

.btn.btn-revisa:hover:not(:disabled) {
  background: #1b5e20;
}

.btn.btn-revisa:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.produto-sku-actions {
  display: none;
}

.produto-sku-actions .btn {
  min-width: 5.5rem;
}

.produto-sku-actions-slot {
  flex: 1 1 auto;
  min-width: 0;
}

.produto-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
}

.produto-tab.is-active {
  border-color: #1a5f96;
  background: #e8f1f8;
  color: #0d2a44;
}

.produto-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.produto-eans-panel {
  display: grid;
  gap: 10px;
}

.produto-ean-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.produto-ean-add input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.produto-eans-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
  overflow: hidden;
}

.produto-ean-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm);
}

.produto-ean-row:last-child {
  border-bottom: 0;
}

.produto-ean-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.produto-ean-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.produto-api-preview {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #9ec5e8;
  border-radius: 10px;
  background: #eef6fc;
}

.produto-api-preview h4 {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
}

.produto-api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.produto-imendes-browse {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #c5d4c0;
  border-radius: 10px;
  background: #f4f8f2;
}

.produto-imendes-browse h4 {
  margin: 0 0 6px;
  font-size: var(--fs-sm);
}

.produto-imendes-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.produto-imendes-search input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.produto-imendes-list {
  max-height: min(42vh, 360px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  border: 1px solid #d5e0d0;
  border-radius: 8px;
  background: #fff;
}

.produto-imendes-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #e8eee5;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.produto-imendes-item:last-child {
  border-bottom: 0;
}

.produto-imendes-item:hover,
.produto-imendes-item:focus-visible {
  background: rgba(46, 125, 50, 0.08);
  outline: none;
}

.produto-imendes-item.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.produto-imendes-desc {
  font-weight: 600;
  line-height: 1.35;
}

.produto-imendes-pick {
  font-size: var(--fs-xs, 0.75rem);
  color: #2e7d32;
  font-weight: 600;
}

.produto-imendes-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.contrato-emp-row .btn-remove-emp {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: #8a3b2c;
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: var(--fs-xs, 0.75rem);
  cursor: pointer;
}

.btn-ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: var(--fs-xs, 0.75rem);
  cursor: pointer;
}

.cad-form h3 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}

.status-line {
  min-height: 1.1em;
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.status-line.is-collapsed {
  display: none;
}

.status-line.is-ok { color: var(--ready); }
.status-line.is-error { color: #8f1d1d; }
.status-line.is-loading { color: var(--study); }

.produto-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}

.produto-filters.hidden,
.cad-toolbar.hidden {
  display: none !important;
}

.produto-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.produto-filter span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.produto-filter input {
  font: inherit;
  font-size: var(--fs-sm);
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 110px;
}

.produto-filter-desc {
  flex: 1 1 220px;
}

.produto-filter-desc input {
  width: 100%;
  min-width: 180px;
}

#btnFiltroProdPesquisar {
  flex: 0 0 auto;
  margin-bottom: 1px;
}

#produtoFilters .dbf-chip {
  align-self: center;
  margin-bottom: 1px;
}

.form-note {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.35;
}

.cad-list-head .form-note {
  margin: 0;
  text-align: right;
}

/* ?? Login + permiss?es ?? */
body.is-logged-out .app-shell { display: none !important; }
body.is-logged-in .login-gate { display: none !important; }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 151, 185, 0.16), transparent 42%),
    radial-gradient(circle at 80% 80%, rgba(0, 151, 185, 0.08), transparent 40%),
    linear-gradient(160deg, #e8eef2 0%, #f0f2f5 55%, #dce8ee 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px 28px 22px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(21, 32, 39, 0.12);
}

.login-eyebrow {
  margin: 0;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
}

.login-lead {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.login-card label {
  display: grid;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.login-card input {
  font: inherit;
  font-size: var(--fs-sm);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.login-status {
  min-height: 1.2em;
  margin: 0;
  font-size: var(--fs-sm);
  color: #9b2c2c;
}

.login-status.is-ok { color: var(--accent); }

.login-hint {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.login-switch {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--accent, #0b6e86);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
}

.sol-card { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sol-card p { margin: 0 0 6px; }
.sol-acoes { display: flex; flex-wrap: wrap; gap: 6px; }
.sol-aviso { margin: 0 0 12px; color: #9b2c2c; }
.sol-aviso.is-ok { color: var(--accent, #0b6e86); }
.sol-acesso {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4fafb;
}
.sol-acesso p { margin: 6px 0 0; }
.sol-tabs { display: flex; gap: 6px; margin: 10px 0 12px; }
.sol-tabs button.is-on { background: var(--accent, #0b6e86); color: #fff; border-color: transparent; }
.sol-pane[hidden] { display: none; }
.sol-mods { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 14px; }
.sol-mods label { display: flex; gap: 8px; align-items: center; }
.sol-mod { border-top: 1px solid var(--line); padding-top: 8px; }
.sol-mod-nome { font-weight: 600; }
.sol-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin: 6px 0 0 18px; }
.sol-campo { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; max-width: 420px; }
.sol-campo input, .sol-campo select { font: inherit; padding: 6px 8px; }

.btn-logout {
  padding: 4px 10px;
  font-size: var(--fs-xs);
}

.menu-access {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f4ee;
}

.menu-access-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.menu-access-head h4 {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink);
}

.menu-access-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.menu-access-actions .btn {
  padding: 4px 8px;
  font-size: var(--fs-xs);
}

.menu-access-mod {
  margin-top: 10px;
}

.menu-access-mod > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--ink);
  list-style: none;
}

.menu-access-mod > summary::-webkit-details-marker { display: none; }

.menu-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 12px;
  margin-top: 8px;
}

.menu-access-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--ink);
  line-height: 1.3;
}

.menu-access-item input {
  margin-top: 2px;
  flex: 0 0 auto;
}

.menu-access-item .pdv-perm-val {
  width: 72px;
  margin-left: auto;
  padding: 2px 6px;
  font-size: 12px;
}

.menu-access.is-admin-locked {
  opacity: 0.55;
  pointer-events: none;
}

.menu-access-note {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  color: var(--muted);
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }
  body.rail-collapsed {
    grid-template-columns: 1fr;
  }
  .mapa-rail {
    max-height: none;
    min-height: auto;
    width: 100%;
  }
  body.rail-collapsed .mapa-rail,
  body.rail-collapsed .mapa-rail:hover,
  body.rail-collapsed .mapa-rail.is-peek {
    position: relative;
    width: 100%;
    box-shadow: none;
  }
  .menu-flyout {
    left: 0 !important;
    width: 100% !important;
    top: auto;
    height: min(70vh, 520px);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.28);
  }
  .cad-head { flex-direction: column; }
  .cad-list-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .cad-list-head .form-note {
    text-align: left;
  }
}

/* Liquida??o CpLiqrec / CPLIQREC */
.liq-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.liq-panel .form-section,
.liq-panel .liq-pane {
  /* N?O usar o grid auto-fill do .form-section ? esmagava o liq-grid */
  display: block;
  border-top: none;
  padding-top: 0;
  width: 100%;
  min-width: 0;
}

.liq-panel .form-section h4,
.liq-panel .liq-pane > h4 {
  margin: 0 0 8px;
  grid-column: auto;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.liq-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.liq-tab {
  appearance: none;
  border: 1px solid var(--line);
  border-bottom: none;
  background: #ebe8e1;
  color: var(--muted);
  padding: 8px 14px;
  font: inherit;
  font-size: var(--fs-sm);
  border-radius: 8px 8px 0 0;
  cursor: default;
}

.liq-tab.is-active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  position: relative;
  bottom: -1px;
  border-color: var(--line);
}

.liq-tab:not(:disabled) {
  cursor: pointer;
}

.liq-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.liq-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px 16px;
  width: 100%;
  min-width: 0;
  align-items: start;
}

.liq-grid > label {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  min-width: 0;
  align-content: start;
}

.liq-grid > label > span:first-child {
  font-size: var(--fs-xs);
  color: var(--muted);
}

.liq-grid input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.liq-grid .lookup-input-wrap {
  width: 100%;
  min-width: 0;
}

.liq-grid .lookup-desc,
.liq-grid .field-hint {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liq-span-4 {
  grid-column: 1 / -1;
}

.liq-span-2 {
  grid-column: span 2;
}

.liq-cliente-wrap {
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.liq-cliente-wrap input {
  width: 100%;
  min-width: 0;
}

.liq-readonly {
  background: #f3f1ec !important;
  color: var(--muted);
}

.liq-summary {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf7f1;
  font-size: var(--fs-sm);
  margin-bottom: 10px;
}

.liq-summary strong {
  color: #1a5f96;
}

.liq-note {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 8px 0 0;
}

.liq-diff-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #c9b896;
  border-radius: 8px;
  background: #fff8e8;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--ink);
}

.liq-diff-banner strong {
  color: #8a5a00;
}

.lote-span-2 {
  grid-column: span 2;
}

/* Baixa Lote CpBaiCli */
.lote-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.lote-head {
  margin-bottom: 4px;
}

.lote-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lote-table-wrap {
  overflow: auto;
  max-height: min(42vh, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lote-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-browse);
}

.lote-table th,
.lote-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.lote-table th {
  position: sticky;
  top: 0;
  background: #f3f1ec;
  font-weight: 600;
  z-index: 1;
}

.lote-col-check {
  width: 52px;
  text-align: center;
}

.lote-col-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lote-col-lj {
  width: 48px;
}

/* Conciliação diária: pills de situação + Vincular visível */
.lote-panel.cx-panel {
  width: 100%;
  max-width: 100%;
}

.lote-table-wrap.cx-mov-wrap {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

.cx-mov-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  font-size: 0.75rem;
}

.cx-mov-table th,
.cx-mov-table td {
  padding: 2px 5px;
  vertical-align: middle;
}

.cx-mov-table .lote-col-data {
  width: 4.8rem;
}

.cx-mov-table .lote-col-lado {
  width: 4.6rem;
}

.cx-mov-table .lote-col-desc {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-mov-table .lote-col-doc {
  width: 4.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-mov-table .lote-col-val {
  width: 5.2rem;
  font-weight: 700;
}

.cx-mov-table .lote-col-val.cx-val-credito {
  color: #2a9d4b;
}

.cx-mov-table .lote-col-val.cx-val-debito {
  color: #c0392b;
}

.cx-mov-table .lote-col-sit {
  width: 8.2rem;
  white-space: nowrap;
  overflow: visible;
}

.cx-mov-table .lote-col-acao {
  position: sticky;
  right: 0;
  width: 8.6rem;
  min-width: 8.6rem;
  white-space: nowrap;
  overflow: visible;
  background: #fff;
  z-index: 2;
}

.cx-mov-table th.lote-col-acao {
  background: #f3f1ec;
  z-index: 3;
}

.cx-mov-table .lote-col-tit {
  width: 6.8rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-mov-table .lote-col-acao .btn {
  min-height: 20px;
  height: 20px;
  padding: 0 7px;
  font-size: 0.68rem;
  line-height: 18px;
  white-space: nowrap;
  margin: 0 2px 0 0;
  vertical-align: middle;
}

.cx-icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  padding: 0;
  margin: 0 3px 0 0;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
}

.cx-icon-btn:hover {
  background: var(--accent-hover);
}

.cx-icon-btn svg {
  display: block;
  width: 12px;
  height: 12px;
}

.cx-picker {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line, #ccc);
  border-radius: 6px;
  background: #fff;
}

.cx-picker-search {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}

.cx-picker-search input {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
}

#cxPickerPesq {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#cxPickerPesq svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.cx-picker-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

.cx-picker-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  text-align: left;
  justify-content: flex-start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 28px;
  height: auto !important;
  max-height: none !important;
  line-height: 1.35 !important;
  padding: 6px 10px !important;
  margin: 0;
  border: 1px solid var(--line, #d5dbe3);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-browse);
  font-weight: 400;
  cursor: pointer;
}

.cx-picker-item.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.cx-pick-mark {
  display: inline-block;
  width: 14px;
  font-weight: 700;
}
.cx-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#cxPickerClose {
  margin-top: 8px;
}

.cx-sit-chip,
.cx-lado-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 6px;
  line-height: 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  vertical-align: middle;
}

.cx-sit-chip.is-rosa {
  color: #9b2250;
  background: #fde8f0;
  border-color: #e85a8a;
}

.cx-sit-chip.is-amarelo {
  color: #7a5a00;
  background: #fff6d6;
  border-color: #e6b800;
}

.cx-sit-chip.is-verde {
  color: #1a7a3c;
  background: #e5f6ea;
  border-color: #2a9d4b;
}

.cx-lado-chip.is-credito {
  color: #1a7a3c;
  background: #e5f6ea;
  border-color: #2a9d4b;
}

.cx-lado-chip.is-debito {
  color: #a32020;
  background: #fde8e8;
  border-color: #c0392b;
}

.cx-mov-table tr.cx-row-credito:not(.lote-row-sel) td {
  background: #f7fcf8;
}

.cx-mov-table tr.cx-row-debito:not(.lote-row-sel) td {
  background: #fdf7f7;
}

.cx-mov-table tr.cx-row-credito:not(.lote-row-sel) td.lote-col-acao {
  background: #f7fcf8;
}

.cx-mov-table tr.cx-row-debito:not(.lote-row-sel) td.lote-col-acao {
  background: #fdf7f7;
}

.cx-mov-table tr.lote-row-sel td.lote-col-acao {
  background: #eef6fb;
}

.cx-panel .lote-totais {
  font-size: 0.78rem;
  gap: 16px;
}

.cx-panel #cx_tot_cred {
  color: #2a9d4b;
}

.cx-panel #cx_tot_deb {
  color: #c0392b;
}

.lote-row-sel {
  background: #eef6fb;
}

.lote-totais {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: var(--fs-md);
}

.lote-totais strong {
  color: #1a5f96;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .liq-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 640px) {
  .liq-grid {
    grid-template-columns: 1fr;
  }
  .liq-span-2,
  .lote-span-2 {
    grid-column: 1 / -1;
  }
  .liq-cliente-wrap {
    grid-template-columns: 1fr;
  }
}

/* Altera Preços por EAN (Cpcodbar) */
.ap-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 920px;
}
.ap-panel .menu-access-note {
  margin: 0;
  color: var(--muted, #667);
  font-size: 0.9rem;
}
.ap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px 14px;
  align-items: start;
}
.ap-grid > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 0.85rem;
}
.ap-grid > label > span:first-child {
  font-weight: 600;
  color: var(--text, #222);
}
.ap-grid input[type='text'],
.ap-grid input[type='number'],
.ap-grid input[type='date'],
.ap-grid select,
.ap-grid input:not([type]) {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.ap-grid input:focus {
  outline: 2px solid #f5d76e;
  outline-offset: 0;
  border-color: #e0c040;
}
.ap-span-2 {
  grid-column: span 2;
}
.ap-flags {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
}
.ap-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.ap-check input {
  margin-top: 3px;
}
.ap-classi-actions {
  display: flex;
  gap: 8px;
}
.ap-classi-previa {
  font-size: 13px;
}
.ap-classi-previa .mp-table-wrap {
  max-height: 280px;
  overflow: auto;
  margin-top: 8px;
}
.ap-grid .lookup-input-wrap input {
  min-height: 34px;
}
@media (max-width: 900px) {
  .ap-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}
@media (max-width: 560px) {
  .ap-grid {
    grid-template-columns: 1fr;
  }
  .ap-span-2 {
    grid-column: 1 / -1;
  }
}

.eg-panel .eg-nome {
  margin: 0;
  min-height: 1.2em;
  color: var(--muted, #667);
  font-size: 0.92rem;
}
.eg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.eg-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0 16px;
}
.eg-preview .muted {
  width: 100%;
}
.eg-label {
  background: #fff;
  border: 1px solid #222;
  box-sizing: border-box;
  padding: 8px 10px 6px;
}
.eg-label-gondola {
  width: 360px;
  min-height: 148px;
}
.eg-label-prod {
  width: 128px;
  min-height: 148px;
}
.eg-label header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.eg-label .eg-desc {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 4px;
  line-height: 1.15;
}
.eg-label-prod .eg-desc {
  font-size: 11px;
}
.eg-label .eg-data {
  font-size: 11px;
  white-space: nowrap;
}
.eg-label .eg-preco {
  font-size: 32px;
  font-weight: 800;
  margin: 4px 0;
  letter-spacing: -1px;
}
.eg-label .eg-preco span {
  font-size: 16px;
}
.eg-label .eg-preco-sm {
  font-size: 14px;
  font-weight: 700;
  margin: 2px 0;
}
.eg-label .eg-ean-txt,
.eg-label .eg-meta,
.eg-label .eg-loja {
  font-size: 11px;
  margin: 2px 0 0;
}
.eg-oferta {
  font-size: 10px;
  background: #c00;
  color: #fff;
  padding: 1px 5px;
  margin-right: 6px;
  vertical-align: middle;
}
.eg-ean-svg {
  display: block;
  margin: 4px auto 0;
  max-width: 100%;
  height: auto;
}
.eg-panel label.is-disabled {
  opacity: 0.55;
}

/* Pedido de Venda — ficha compacta estilo desktop (cab + itens + totais) */
#viewCadastro.is-pedido-venda.cad-mode-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-head {
  flex: 0 0 auto;
  margin-bottom: 2px;
  gap: 8px;
  align-items: center;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-head .eyebrow {
  display: none;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-head h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-actions .btn {
  padding: 5px 10px;
  font-size: 0.82rem;
}

/* Browse de pedidos (venda / transferência / compra) — mais espaço entre linhas */
#pedidoVendaListaWrap .nfe-sefaz-table {
  font-size: 0.9rem;
  line-height: 1.35;
}
#pedidoVendaListaWrap .nfe-sefaz-table th,
#pedidoVendaListaWrap .nfe-sefaz-table td {
  padding: 10px 12px !important;
  line-height: 1.35 !important;
  height: auto !important;
  min-height: 40px;
}
#pedidoVendaListaWrap .nfe-sefaz-table thead th {
  padding: 10px 12px !important;
  height: auto !important;
  font-size: 0.78rem;
}
#pedidoVendaListaWrap .nfe-sefaz-table tbody tr {
  height: auto !important;
}
#pedidoVendaListaWrap .nfe-sefaz-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}
#pedidoVendaListaWrap .nfe-sefaz-table tbody tr:hover td {
  background: #eef2ff;
}
#pedidoVendaListaWrap .nfe-sefaz-table .btn {
  padding: 5px 12px;
  font-size: 0.82rem;
  min-height: 30px;
}

#viewCadastro.is-pedido-venda.cad-mode-form .status-line {
  flex: 0 0 auto;
  margin: 0 0 4px;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.25;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-layout {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-form {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 8px;
  border-radius: 10px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .cad-form-head {
  display: none;
}
#viewCadastro.is-pedido-venda.cad-mode-form .cad-form-fields {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-lista-note {
  display: none;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-venda-panel {
  flex: 1;
  min-height: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha #pedidoVendaFichaWrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha #pedidoVendaFichaWrap > .ped-ficha {
  flex: 1;
  min-height: 0;
}
/* abas | conteúdo */
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-ficha-desktop {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  gap: 2px;
  overflow: hidden;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-tabs {
  grid-row: 1;
  margin: 0;
  padding: 0;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-tab {
  padding: 5px 12px;
  font-size: 0.82rem;
}
/* cab (não encolhe) | itens (rola) | rodapé totais (não encolhe) */
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-aba-pedido {
  grid-row: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  gap: 4px;
  overflow: hidden;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-aba-pedido.hidden {
  display: none !important;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-aba-aux {
  grid-row: 2;
  min-height: 0;
  overflow: auto;
  padding: 4px 0;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-aba-aux.hidden {
  display: none !important;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-cab {
  min-height: 54px;
  overflow: visible;
  align-self: start;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-area {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
  padding: 2px 4px 3px;
  gap: 2px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-toolbar {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0 2px;
  gap: 6px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-title {
  font-size: 0.8rem;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-hint {
  font-size: 0.7rem;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-toolbar .btn {
  padding: 2px 8px;
  font-size: 0.75rem;
  min-height: 22px;
  height: 22px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-itens-wrap {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: none !important;
  overflow: auto;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-rodape-desktop {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 6px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
}

/* Pedido de Venda / Orçamento */
.ped-venda-panel {
  max-width: 1200px;
  width: 100%;
}
.ped-ficha {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ped-ficha-desktop {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 4px;
  min-height: 0;
}
.ped-cab {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) 88px 128px minmax(240px, 1.8fr) minmax(180px, 1.1fr);
  gap: 8px 12px;
  align-items: stretch;
  padding: 8px 10px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
}
.ped-cab label {
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #456;
  margin: 0;
  min-width: 0;
}
.ped-cab label > span {
  line-height: 1.1;
}
.ped-cab input,
.ped-cab select {
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
  width: 100%;
  padding: 4px 8px;
  font-size: 0.85rem;
}
.ped-cab .lookup-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  height: 32px;
}
.ped-cab .lookup-input-wrap > input:first-of-type {
  flex: 0 0 70px;
  width: 70px;
  max-width: 70px;
  min-height: 32px;
  height: 32px;
}
.ped-cab .btn-lookup {
  flex: 0 0 auto;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
}
.ped-nome-readonly {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  min-height: 32px !important;
  height: 32px !important;
  background: #eef2f7 !important;
  border: 1px solid var(--line, #ccd);
  color: #234;
  cursor: default;
}
#lookup_desc_ped_peclient.ped-nome-readonly {
  font-size: 1.08rem !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #123;
}
.ped-cab:has(.ped-os-field:not(.hidden)) {
  grid-template-columns: minmax(110px, 0.8fr) 88px 128px minmax(160px, 1.2fr) minmax(150px, 1fr);
}
.ped-cab:has(.ped-os-field:not(.hidden)) .ped-cab-cli {
  grid-column: 1 / 4;
}
.ped-cab:has(.ped-os-field:not(.hidden)) .ped-cab-rep {
  grid-column: 4 / 6;
}
.ped-itens-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ped-itens-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1e4d7b;
}
.ped-itens-hint {
  font-size: 0.78rem;
  margin-right: auto;
}
.ped-barra-totais {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ped-saldo-box {
  display: flex !important;
  flex-direction: column;
  gap: 1px;
  font-size: 0.72rem;
  margin: 0;
  min-width: 100px;
}
.ped-saldo-box input {
  width: 100px;
  font-weight: 600;
  background: #f4f7fb;
  min-height: 28px;
  height: 28px;
  box-sizing: border-box;
}

.ped-credito-hint {
  margin: 2px 0 0;
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.ped-credito-hint.is-warn {
  color: #8f1d1d;
  font-weight: 600;
}
.ped-total-pedido {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 148px;
  margin-left: auto;
  padding: 4px 12px;
  background: #1e4d7b;
  color: #fff;
  border-radius: 6px;
  line-height: 1.15;
}
.ped-total-pedido span {
  font-size: 0.7rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ped-total-pedido strong {
  font-size: 1.2rem;
  font-weight: 700;
}
.ped-item-detalhe {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: stretch;
}
.ped-item-detalhe .ped-saldo-box {
  flex: 0 1 88px;
  min-width: 0;
  width: auto;
}
.ped-item-detalhe .ped-saldo-box input {
  width: 100%;
}
.ped-item-detalhe > label {
  flex: 1 1 64px;
}
.ped-item-detalhe .ped-total-pedido {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: stretch;
  justify-content: center;
  justify-self: end;
}
.ped-item-detalhe label {
  display: flex !important;
  flex-direction: column;
  gap: 1px;
  font-size: 0.7rem;
  margin: 0;
  min-width: 0;
  color: #556;
}
.ped-item-detalhe input {
  font-size: 0.8rem;
  background: #f4f7fb;
  padding: 3px 6px;
  min-height: 26px;
  height: 26px;
  box-sizing: border-box;
}
.ped-itens-table tr.is-selected {
  background: var(--accent-soft);
}
.ped-itens-table tr.is-selected td {
  background: transparent;
}
.ped-rodape {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px 8px;
  align-items: start;
  padding: 6px 10px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
}
.ped-rodape-aux {
  max-height: none;
}
.ped-rodape > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  margin: 0;
  min-width: 0;
}
.ped-rodape .lookup-desc {
  font-size: 0.7rem;
  color: #556;
  min-height: 0;
  max-height: 1.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ped-rodape .lookup-desc:empty {
  display: none;
}
.ped-rodape .ped-obs {
  grid-column: 1 / -1;
}
.ped-rodape-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}
.ped-espelho-compra {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-right: auto;
  padding: 6px 12px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 0.85rem;
  max-width: min(100%, 420px);
}
.ped-espelho-compra.is-warn {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
.ped-espelho-compra .ped-espelho-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  opacity: 0.9;
}
.ped-espelho-compra .ped-espelho-num {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #78350f;
  letter-spacing: 0.02em;
}
.ped-espelho-compra .ped-espelho-sit {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.85;
}
.ped-rodape-actions .btn.primary {
  background: var(--accent, #1a5f3a);
  color: #fff;
  border-color: var(--accent, #1a5f3a);
}
.ped-rodape-actions .btn.primary:hover {
  filter: brightness(1.06);
}
.ped-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line, #ccd);
  margin-bottom: 2px;
}
.ped-tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: #456;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
}
.ped-tab:hover:not(:disabled) {
  color: #1e4d7b;
  background: #f4f7fb;
}
.ped-tab.is-active {
  color: #1e4d7b;
  background: #fff;
  border-color: var(--line, #ccd);
  border-bottom-color: #fff;
}
.ped-tab:disabled,
.ped-tab.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.ped-aba {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ped-quadro {
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px 14px;
}
.ped-quadro-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.ped-quadro-head h4 {
  margin: 0;
  font-size: 1rem;
  flex: 1;
}
.ped-quadro-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #1e4d7b;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.ped-ficha-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}
.ped-ficha-grid-q1 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ped-ficha-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.ped-ficha-grid .ped-span-2 {
  grid-column: span 2;
}
.ped-hint {
  color: #556;
  font-size: 0.8rem;
  min-height: 1em;
}
.ped-itens-wrap {
  max-height: min(48vh, 420px);
  overflow: auto;
  scroll-behavior: auto;
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
  background: #fff;
}
.ped-quadro-itens {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ped-quadro-itens .ped-quadro-head {
  margin-bottom: 0;
}
.ped-totais-itens {
  margin-top: 0;
  z-index: 2;
}
/* Grade de itens — densa, tipografia um pouco maior */
#viewCadastro.is-pedido-venda .ped-itens-table,
.ped-itens-table {
  border-collapse: collapse;
  font-size: 0.84rem;
  line-height: 1.15;
}
#viewCadastro.is-pedido-venda .ped-itens-table th,
#viewCadastro.is-pedido-venda .ped-itens-table td,
.ped-itens-table th,
.ped-itens-table td {
  padding: 0 4px !important;
  line-height: 1.15 !important;
  vertical-align: middle !important;
  height: 24px !important;
  border-bottom: 1px solid #e4e7ec;
}
#viewCadastro.is-pedido-venda .ped-itens-table thead th,
.ped-itens-table thead th {
  padding: 3px 4px !important;
  height: 24px !important;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
#viewCadastro.is-pedido-venda .ped-itens-table tbody tr,
.ped-itens-table tbody tr {
  height: 24px !important;
}
#viewCadastro.is-pedido-venda .cad-form .ped-itens-table input,
#viewCadastro.is-pedido-venda .cad-form .ped-itens-table select,
#viewCadastro.is-pedido-venda .ped-itens-table input,
#viewCadastro.is-pedido-venda .ped-itens-table select,
.ped-itens-table input,
.ped-itens-table select {
  width: 100%;
  min-width: 0;
  font-size: 0.84rem !important;
  padding: 0 4px !important;
  min-height: 20px !important;
  height: 20px !important;
  max-height: 20px !important;
  line-height: 20px !important;
  border-radius: 3px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-ean,
.ped-itens-table .ped-it-ean {
  min-width: 108px;
}
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-qtd,
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-uni,
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-pct,
.ped-itens-table .ped-it-qtd,
.ped-itens-table .ped-it-uni,
.ped-itens-table .ped-it-pct {
  max-width: 88px;
  text-align: right;
}
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-uni,
.ped-itens-table .ped-it-uni {
  max-width: 100px;
  min-width: 84px;
}
#viewCadastro.is-pedido-venda .ped-itens-table .ped-it-cond,
.ped-itens-table .ped-it-cond {
  max-width: 46px;
  padding-left: 1px !important;
  padding-right: 1px !important;
}
#viewCadastro.is-pedido-venda .ped-itens-table .btn.ped-it-del,
.ped-itens-table .btn.ped-it-del {
  padding: 0 4px !important;
  min-height: 20px !important;
  height: 20px !important;
  max-height: 20px !important;
  line-height: 1 !important;
  font-size: 0.8rem !important;
  border-radius: 3px !important;
}
#viewCadastro.is-pedido-venda .ped-it-desc,
.ped-it-desc {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-totais-principal {
  padding: 4px 8px;
  font-size: 0.88rem;
  gap: 10px 16px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-barra-totais {
  gap: 8px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-item-detalhe {
  gap: 2px 6px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-item-detalhe input {
  min-height: 22px !important;
  height: 22px !important;
  padding: 1px 4px !important;
  font-size: 0.8rem !important;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-item-detalhe label,
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-saldo-box {
  font-size: 0.78rem;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-saldo-box input {
  min-height: 22px !important;
  height: 22px !important;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-total-pedido {
  padding: 2px 10px;
  min-width: 130px;
}
#viewCadastro.is-pedido-venda.is-pedido-ficha .ped-total-pedido strong {
  font-size: 1.05rem;
}
.ped-totais {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 0;
  padding: 8px 12px;
  background: #f4f7fb;
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
  font-size: 0.92rem;
  align-items: center;
}
.ped-totais-principal {
  width: 100%;
  margin: 0;
}
.ped-tot-geral {
  margin-left: auto;
  font-size: 1.05rem;
}
.ped-quadro2-actions,
.ped-ficha-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .ped-cab {
    grid-template-columns: minmax(110px, 0.9fr) 100px 130px 1fr;
  }
  .ped-cab-rep {
    grid-column: 1 / -1;
  }
  .ped-cab:has(.ped-os-field:not(.hidden)) .ped-cab-cli,
  .ped-cab:has(.ped-os-field:not(.hidden)) .ped-cab-rep {
    grid-column: 1 / -1;
  }
  .ped-item-detalhe {
    display: flex;
  }
  .ped-item-detalhe .ped-total-pedido {
    margin-left: auto;
  }
  .ped-rodape {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .ped-ficha-grid,
  .ped-ficha-grid-q1 {
    grid-template-columns: 1fr 1fr;
  }
  .ped-ficha-grid .ped-span-2 {
    grid-column: 1 / -1;
  }
  .ped-cab {
    grid-template-columns: 1fr 1fr;
  }
  .ped-cab-cli,
  .ped-cab-rep {
    grid-column: 1 / -1;
  }
  .ped-item-detalhe {
    display: flex;
  }
  .ped-item-detalhe .ped-total-pedido {
    margin-left: auto;
  }
  .ped-rodape {
    grid-template-columns: 1fr 1fr;
  }
}

/* Notas Fiscais → Manifesto Sefaz (DistDFe) */
.nfe-sefaz-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: none;
}

.ctm-banner {
  margin: 0 0 4px;
}
.ctm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}
.ctm-grid label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
}
.ctm-span-2 { grid-column: span 2; }
.ctm-docs {
  display: grid;
  gap: 8px;
  min-height: 0;
}
.ctm-docs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ctm-pick-row { cursor: pointer; }
.ctm-pick-row:hover { background: #eef2ff; }
.ctm-pick-row.is-vinculada { opacity: 0.55; }
.btn.tiny {
  padding: 2px 8px;
  font-size: 0.78rem;
}
@media (max-width: 900px) {
  .ctm-grid { grid-template-columns: 1fr 1fr; }
  .ctm-span-2 { grid-column: 1 / -1; }
}

.nfe-saida-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #dbe3ee;
  padding-bottom: 0;
}
.nfe-saida-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #475569;
  font: inherit;
  font-weight: 650;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}
.nfe-saida-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.nfe-saida-tab.is-active {
  background: #fff;
  color: #0f4c81;
  border-color: #dbe3ee;
  box-shadow: inset 0 -2px 0 #0f4c81;
}

.ns-ficha {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}
.ns-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}
.ns-topbar label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 650;
  color: #475569;
}
.ns-topbar input,
.ns-topbar select {
  min-height: 32px;
  min-width: 7rem;
}
#ns_numero { width: 7.5rem; }
#ns_ordem { width: 7rem; }
.ns-sit-badge {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
}
.ns-sit-badge.is-ok { color: #0f4c81; background: #e8f1fb; }
.ns-sit-badge.is-ro { color: #9a3412; background: #ffedd5; }
.ns-aba { min-height: 0; }
.ns-grid-cab {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
}
.ns-grid-cab label,
.ns-item-editor label,
.ns-totais-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 650;
  color: #334155;
}
.ns-span-2 { grid-column: span 2; }
.ns-span-4 { grid-column: 1 / -1; }
.ns-itens-wrap { max-height: min(32vh, 280px); }
.ns-item-row { cursor: pointer; }
.ns-item-row.is-sel { background: #e8f1fb; }
.ns-item-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 620px);
  overflow: auto;
  padding: 4px 2px 8px;
}
.ns-it-sec {
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px 10px;
  background: #f8fafc;
}
.ns-it-sec legend {
  font-size: 0.72rem;
  font-weight: 750;
  color: #0f4c81;
  padding: 0 4px;
}
.ns-it-sec-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px 10px;
}
.ns-it-sec-grid .ns-span-2 { grid-column: span 2; }
.ns-it-sec-grid .ns-span-4 { grid-column: 1 / -1; }
.ns-totais-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
}
.ns-tot-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}
.ns-tot-chip span { font-size: 0.75rem; color: #64748b; font-weight: 650; }
.ns-tot-chip strong { font-size: 1.15rem; color: #0f172a; }
.ns-tot-nf { background: #e8f1fb; border-color: #93c5fd; }
.ns-tot-nf strong { color: #0f4c81; }
.ns-flow-hint { margin: 6px 0 8px; }
.ns-retorno {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
}
.ns-retorno.is-ok { border-color: #86efac; background: #f0fdf4; }
.ns-retorno.is-err { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.ns-retorno.is-wait { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.ns-retorno.is-info { border-color: #93c5fd; background: #eff6ff; color: #1e3a8a; }
.ns-retorno-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.ns-retorno-sit {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ns-retorno-msg { margin: 0 0 8px; font-size: 0.86rem; line-height: 1.35; }
.ns-retorno-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 12px;
  margin: 0;
}
.ns-retorno-grid div { min-width: 0; }
.ns-retorno-grid dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.75;
}
.ns-retorno-grid dd {
  margin: 0;
  font-size: 0.84rem;
  word-break: break-all;
}
.ns-retorno-grid .mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; }
.ns-retorno-grid .ns-ret-full { grid-column: 1 / -1; }
.ns-retorno-grid .ns-ret-full dd { word-break: break-all; }
.ns-remessa-link {
  display: inline-block;
  margin-right: 8px;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: underline;
}
.ns-erros {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #7f1d1d;
}
.ns-erros-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.88rem;
}
.ns-erros-head span { font-weight: 600; color: #991b1b; }
.ns-erros ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ns-erros li {
  font-size: 0.84rem;
  line-height: 1.35;
  cursor: pointer;
}
.ns-erros li:hover { text-decoration: underline; }
.ns-erros-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ns-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}
.ns-picker {
  position: relative;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.ns-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.nfe-saida-panel.is-notas-consulta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.ns-picker.ns-notas-full:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 0;
  border: none;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
.ns-picker.ns-notas-full .ordens-venda-table-wrap {
  flex: 1;
  min-height: 200px;
  max-height: none;
}
#viewCadastro.is-ns-notas-consulta.cad-mode-form .cad-form {
  overflow: hidden;
}
.ns-ficha-body[hidden] {
  display: none !important;
}
.ns-nota-actions { display: inline-flex; gap: 2px; justify-content: center; }
.ns-actions-icons {
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
}
.ns-actions-icons-lbl {
  font-size: 0.78rem;
  color: #64748b;
  margin-right: 4px;
}
.ns-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.ns-act-btn:hover:not(:disabled) { background: #eef2ff; border-color: #94a3b8; }
.ns-act-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ns-act-btn.ns-act-danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; }
.ns-sit-badge.ok { color: #166534; font-weight: 600; }
.ns-sit-badge.err { color: #b91c1c; font-weight: 600; }

.ns-email-panel {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 16px;
}
.ns-email-panel[hidden] { display: none !important; }
.ns-email-box {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  padding: 16px 18px 18px;
  display: grid;
  gap: 10px;
}
.ns-email-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ns-email-head h4 { margin: 0; font-size: 1.05rem; }
.ns-email-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  padding: 0 4px;
}
.ns-email-box textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.ns-evento-faixa {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ns-email-box input[readonly] { background: #f8fafc; color: #334155; }
.ns-email-resumo {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.ns-email-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 0.85rem;
}
.ns-email-dl dt { color: #64748b; margin: 0; }
.ns-email-dl dd { margin: 0; font-weight: 600; }
.ns-email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.ns-email-actions .btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.ns-notas-table .mono { font-size: 0.72rem; }
.ns-pick-row { cursor: pointer; }
.ns-pick-row:hover { background: #f1f5f9; }
@media (max-width: 1100px) {
  .ns-grid-cab,
  .ns-totais-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ns-it-sec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.nfe-saida-detalhe {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
}
.nfe-saida-detalhe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.nfe-saida-panel .ordens-venda-table-wrap {
  max-height: min(58vh, 560px);
}
.nfe-sefaz-meta {
  padding: 8px 12px;
  background: #f4f7fb;
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
  font-size: 0.92rem;
}
.nfe-sefaz-meta .ok { color: #1a7a3c; font-weight: 600; }
.nfe-sefaz-meta .err { color: #b33; font-weight: 600; }
.nfe-ent-meta-head {
  margin-bottom: 2px;
  font-size: 0.82rem;
  line-height: 1.25;
}
.nfe-ent-fornec {
  margin: 2px 0;
  font-size: 0.8rem;
}
.nfe-ent-dups {
  margin: 2px 0 0;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.nfe-ent-totais {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 5px;
  padding-top: 4px;
  border-top: 1px dashed var(--line, #ccd);
}
.nfe-ent-tot-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 0 5px;
  background: #fff;
  border: 1px solid #d5dde8;
  border-radius: 3px;
  font-size: 0.72rem;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.nfe-ent-tot-chip em {
  font-style: normal;
  color: #5a6a7a;
  font-weight: 600;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nfe-ent-import-pasta select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c5d0de;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.nfe-ent-import-pasta select[size] {
  min-height: 160px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
}
.nfe-ent-import-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.nfe-ent-tot-chip.is-zero {
  opacity: 0.55;
}
.nfe-ent-tot-chip:last-child {
  border-color: #9bb0c8;
  background: #eef4fb;
  font-weight: 600;
}
.nfe-sefaz-totais {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.nfe-sefaz-tot-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 148px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #d5dde8;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  border-left-width: 5px;
}
.nfe-sefaz-tot-chip em {
  font-style: normal;
  color: #5a6a7a;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.nfe-sefaz-tot-chip strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a2430;
  line-height: 1.2;
}
.nfe-sefaz-tot-chip span {
  font-size: 0.78rem;
  color: #5a6a7a;
}
.nfe-sefaz-tot-chip.is-rosa { border-left-color: #e85a8a; background: #fde8f0; }
.nfe-sefaz-tot-chip.is-vermelho { border-left-color: #c0392b; background: #fdecea; }
.nfe-sefaz-tot-chip.is-amarelo { border-left-color: #f0c400; background: #fff6d6; }
.nfe-sefaz-tot-chip.is-verde { border-left-color: #2a9d4b; background: #e5f6ea; }
.nfe-sefaz-tot-chip.is-todas { border-left-color: #3a6ea5; background: #eef4fb; }
.nfe-sefaz-tot-chip.is-ativo {
  box-shadow: 0 0 0 2px rgba(29, 111, 216, 0.35);
}
.nfe-sefaz-tot-chip.is-zero {
  opacity: 0.62;
}
.nfe-sefaz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.nfe-sefaz-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}
.nfe-sefaz-filter select,
.nfe-consulta-panel .nfe-sefaz-filter input {
  min-height: 32px;
  min-width: 140px;
  padding: 4px 8px;
}
.nfe-consulta-panel .nfe-sefaz-tot-chip { cursor: pointer; }
.nfe-consulta-prod {
  margin: 0;
  padding: 8px 12px;
  background: #eef6ff;
  border: 1px solid #c5d7ee;
  border-radius: 6px;
}
.nfe-consulta-panel .nc-chave {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  min-width: 46ch;
  width: 46ch;
}
.nfe-sefaz-table-wrap {
  max-height: min(55vh, 480px);
  overflow: auto;
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
}
.nfe-xml-heading {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 700;
}
.nfe-xml-import-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 4px 0 8px;
}
.nfe-xml-chave-wrap {
  flex: 1 1 280px;
  min-width: 220px;
}
.nfe-xml-chave-wrap input {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #c5d0de;
  border-radius: 6px;
  font: inherit;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.02em;
}
.nfe-xml-ultima-wrap {
  max-height: 160px;
}
.nfe-ent-browse-wrap {
  max-height: min(58vh, 520px);
}
/* Linhas compactas — mesmo padrão do pedido de venda (24px) */
.nfe-sefaz-table {
  border-collapse: collapse;
  font-size: var(--fs-browse);
  line-height: 1.15;
}
.nfe-sefaz-table th,
.nfe-sefaz-table td {
  padding: 0 4px !important;
  line-height: 1.15 !important;
  vertical-align: middle !important;
  height: 24px !important;
  border-bottom: 1px solid #e4e7ec;
}
.nfe-sefaz-table thead th {
  padding: 3px 4px !important;
  height: 24px !important;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.nfe-sefaz-table tbody tr {
  height: 24px !important;
}
.nfe-sefaz-table .btn,
.nfe-sefaz-table .nfe-btn-importar,
.nfe-sefaz-table .nfe-btn-vincular {
  min-height: 20px !important;
  height: 20px !important;
  padding: 0 6px !important;
  font-size: 0.72rem !important;
  line-height: 18px !important;
}
.nfe-sefaz-table .nfe-ico {
  width: 22px;
  height: 22px;
}
.nfe-sefaz-table .nfe-bola {
  width: 11px;
  height: 11px;
}
.nfe-sefaz-table .col-cnpj {
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  word-break: keep-all;
  overflow-wrap: normal;
}
.nfe-sefaz-table .col-emitente {
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nfe-ent-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 6px;
  line-height: 18px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.nfe-ent-status-rosa {
  color: #9b2250;
  background: #fde8f0;
  border-color: #f0b8cc;
}
.nfe-ent-status-amarelo {
  color: #7a5a00;
  background: #fff6d6;
  border-color: #e6d08a;
}
.nfe-ent-status-verde {
  color: #1a7a3c;
  background: #e5f6ea;
  border-color: #9fd4b0;
}
.nfe-ent-voltar-bar {
  align-items: center;
  margin-bottom: 6px;
}
.nfe-xml-file-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.nfe-sefaz-table tr.is-pending td {
  background: #fdecec;
}
.nfe-sefaz-table tr.is-selected td {
  background: var(--accent-soft);
}
.nfe-sefaz-table tr.is-pending.is-selected td {
  background: #fad4d4;
}
.nfe-ent-sem-vinculo {
  color: #c1121f;
  font-weight: 700;
}
.nfe-legenda {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.nfe-legenda::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.nfe-legenda-rosa::before { background: #e85a8a; }
.nfe-legenda-amarelo::before { background: #e6b800; }
.nfe-legenda-verde::before { background: #2a9d4b; }
.nfe-bola {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  vertical-align: middle;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.45);
}
.nfe-bola-rosa { background: #e85a8a; }
.nfe-bola-vermelho { background: #d64545; }
.nfe-bola-amarelo { background: #f0c400; }
.nfe-bola-verde { background: #2a9d4b; }
.nfe-bola-teal { background: #0d9488; }
.nfe-bola-laranja { background: #e67e22; }
.nfe-row-rosa td { background: #fde8f0; }
.nfe-row-amarelo td { background: #fff6d6; }
.nfe-row-verde td { background: #e5f6ea; }
.nfe-sefaz-table .col-semaforo {
  width: 28px;
  text-align: center;
}
.nfe-sefaz-table .col-acoes {
  white-space: nowrap;
  width: 1%;
}
.nfe-btn-importar {
  margin-left: 4px;
  padding: 2px 8px !important;
  min-height: 26px;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nfe-btn-importar:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.nfe-btn-vincular {
  margin-left: 2px;
  padding: 2px 8px !important;
  min-height: 26px;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
}
.nfe-btn-vincular.nfe-btn-vincular-on {
  background: #1d6fd8;
  border-color: #1a62c0;
  color: #fff;
}
.nfe-btn-vincular.nfe-btn-vincular-on:hover:not(:disabled) {
  background: #155bb8;
  border-color: #134fa0;
  color: #fff;
}
.nfe-btn-vincular:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.nfe-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0 1px;
  border: 1px solid #c5d0de;
  border-radius: 5px;
  background: #fff;
  color: #2a3a4a;
  cursor: pointer;
  vertical-align: middle;
}
.nfe-ico:hover:not(:disabled) {
  background: #eef4fb;
  border-color: #8aa0b8;
}
.nfe-ico:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.nfe-sefaz-dialog {
  width: min(720px, 100%);
  max-height: min(85vh, 800px);
}
.nfe-sefaz-dialog.nfe-danfe-dialog {
  width: min(980px, 98vw);
  max-height: min(92vh, 920px);
}
.nfe-sefaz-dialog-body {
  overflow: auto;
  max-height: min(70vh, 640px);
}
.nfe-danfe-dialog .nfe-sefaz-dialog-body {
  max-height: min(78vh, 780px);
}
.nfe-danfe-dialog .danfe-doc {
  font-size: 8px;
}
.nfe-danfe-dialog .danfe-doc .danfe-val {
  font-size: 8px;
}
.danfe {
  border: 1.5px solid #2a3540;
  padding: 8px;
  background: #fff;
  color: #15202b;
  font-size: 0.82rem;
}
.danfe-top {
  display: grid;
  grid-template-columns: 1.35fr 0.75fr 1.15fr;
  gap: 6px;
  margin-bottom: 6px;
}
@media (max-width: 820px) {
  .danfe-top { grid-template-columns: 1fr; }
}
.danfe-emit,
.danfe-badge,
.danfe-chave,
.danfe-box {
  border: 1px solid #3a4a5a;
  padding: 7px 8px;
  background: #fbfcfe;
}
.danfe-emit-title { font-size: 0.98rem; font-weight: 700; }
.danfe-emit-sub { font-size: 0.82rem; color: #445; margin-top: 2px; }
.danfe-mini { font-size: 0.75rem; color: #4a5a6a; margin-top: 3px; line-height: 1.3; }
.danfe-badge { text-align: center; }
.danfe-badge-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.danfe-badge-sub { font-size: 0.72rem; margin-top: 4px; line-height: 1.25; }
.danfe-badge-io {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border: 1px solid #2a3540;
  font-weight: 700;
  font-size: 0.8rem;
}
.danfe-badge-num { margin-top: 6px; font-weight: 700; font-size: 0.85rem; }
.danfe-chave .lbl,
.danfe-cell .lbl,
.danfe-box-title {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5a6a7a;
}
.danfe-chave .chave {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  margin: 4px 0;
  word-break: break-word;
}
.danfe-row {
  display: grid;
  grid-template-columns: 1.4fr 0.5fr 0.4fr;
  gap: 6px;
  margin-bottom: 6px;
}
.danfe-grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 4px;
}
.danfe-totais {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
@media (max-width: 820px) {
  .danfe-row,
  .danfe-grid-2,
  .danfe-totais { grid-template-columns: 1fr 1fr; }
}
.danfe-cell {
  border: 1px solid #b7c2ce;
  padding: 4px 6px;
  min-height: 38px;
  background: #fff;
}
.danfe-cell .val {
  display: block;
  margin-top: 2px;
  font-size: 0.86rem;
  color: #15202b;
}
.danfe-box { margin-bottom: 6px; }
.danfe-box-title { margin-bottom: 5px; }
.danfe-itens-wrap { overflow: auto; max-height: 280px; }
.danfe-itens {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.danfe-itens th,
.danfe-itens td {
  border: 1px solid #8a9aaa;
  padding: 2px 4px;
  vertical-align: top;
}
.danfe-itens th {
  background: #e8eef4;
  font-size: 0.66rem;
  white-space: nowrap;
}
.danfe-itens .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.danfe-itens .c { text-align: center; }
.danfe-itens .desc { min-width: 140px; }
.danfe-aviso,
.danfe-adic {
  margin: 0;
  padding: 6px 4px;
  line-height: 1.4;
  font-size: 0.82rem;
}
.danfe-foot-note {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: #445;
}
.danfe-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.nfe-preview-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
}
.nfe-preview-dl dt {
  font-size: 0.75rem;
  font-weight: 700;
  color: #5a6a7a;
}
.nfe-preview-dl dd {
  margin: 0 0 4px;
  font-size: 0.92rem;
}
.nfe-chave {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}
.nfe-preview-itens {
  font-size: 0.82rem;
}
.nfe-manifesto-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.nfe-manifesto-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid #c5d0de;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  color: #1a2a3a;
}
.nfe-manifesto-opt:hover:not(:disabled) {
  background: #eef6ff;
  border-color: #7aa0c8;
}
.nfe-manifesto-opt.is-active,
.nfe-manifesto-opt:focus-visible {
  background: #d8ebff;
  border-color: #3a7fc4;
  outline: none;
}
.nfe-manifesto-opt:disabled {
  opacity: 0.55;
  cursor: wait;
}
.nfe-manifesto-msg {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #f4f7fb;
  border: 1px solid #c5d0de;
}
.nfe-manifesto-msg.is-loading {
  background: #fff8e0;
  border-color: #e0c86a;
}
.nfe-manifesto-msg.is-error {
  background: #fdecea;
  border-color: #e0a0a0;
  color: #8f1d1d;
}
.nfe-manifesto-msg.is-ok {
  background: #e8f6ec;
  border-color: #8fc9a0;
  color: #1a7a3c;
}
/* Três quadros do vínculo: cab (auto) | itens (rola) | conferência+F4 (auto) */
.nfe-ent-layout {
  display: contents;
}
.nfe-ent-lista {
  max-height: none !important;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 3;
  pointer-events: auto;
}
.nfe-ent-detalhe {
  border: 1px solid var(--line, #ccd);
  border-radius: 6px;
  background: #f8fafc;
  padding: 6px 8px;
  max-height: none;
  min-height: 0;
  overflow: visible;
  min-width: 0;
  width: 100%;
  position: relative;
  z-index: 1;
}
.nfe-ent-detalhe h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}
.nfe-ent-detalhe h5 {
  margin: 0 0 4px;
  font-size: 0.8rem;
}
.nfe-ent-vinculo-flag {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 0.82rem;
}
.nfe-ent-vinculo-flag.ok { color: #1a7a3c; }
.nfe-ent-vinculo-flag.err { color: #b33; }
.nfe-ent-detalhe-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 4px;
}
.nfe-ent-detalhe-head h4 {
  margin: 0;
  font-size: 0.84rem;
}
.nfe-ent-detalhe-head .nfe-ent-vinculo-flag {
  margin: 0;
  font-size: 0.78rem;
}
.nfe-ent-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.nfe-ent-summary .pb-kv-grid,
.nfe-ent-summary .pb-precos {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px 8px;
}
.nfe-ent-summary .pb-kv {
  min-width: 0;
}
.nfe-ent-summary .pb-kv .pb-v {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .nfe-ent-summary .pb-kv-grid,
  .nfe-ent-summary .pb-precos {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.nfe-ent-cab-valida {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px 8px;
  align-items: flex-end;
  padding: 4px 8px;
  margin-bottom: 4px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
}
.nfe-ent-cab-valida label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.72rem;
  min-width: 0;
  flex: 0 1 auto;
}
.nfe-ent-cab-valida label > span {
  font-weight: 600;
  color: var(--ink, #222);
  white-space: nowrap;
}
.nfe-ent-cab-valida label.nfe-ent-cab-req > span {
  font-weight: 700;
}
.nfe-ent-cab-valida input,
.nfe-ent-cab-valida select {
  min-height: 26px;
  padding: 2px 6px;
  font: inherit;
  font-size: 0.8rem;
  min-width: 0;
}
.nfe-ent-cab-valida .nfe-ent-pedido-lab {
  min-width: 7.5rem;
  flex: 0 1 9rem;
}
.nfe-ent-cab-valida input[readonly] {
  background: #f3f4f6;
  color: #444;
}
.nfe-ent-meta-compact {
  margin: 0 !important;
  padding: 4px 8px !important;
  font-size: 0.8rem;
  line-height: 1.25;
  max-height: none;
  overflow: visible;
}
.nfe-ent-rodape {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line, #ccd);
  border-radius: 8px;
  background: #fff;
  margin-top: 0;
}
.nfe-ent-rodape-hint {
  font-size: 0.78rem;
  min-width: 0;
}
.nfe-ent-rodape-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}
.nfe-ent-rodape-actions .btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Tela de vínculo: cabe na viewport sem rolagem da página */
#viewCadastro.is-nfe-entrada.cad-mode-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  flex: 1;
  overflow: hidden;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-head {
  flex: 0 0 auto;
  margin-bottom: 2px;
  gap: 8px;
  align-items: center;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-head .eyebrow {
  display: none;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-head h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-actions .btn {
  padding: 5px 10px;
  font-size: 0.82rem;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .status-line {
  flex: 0 0 auto;
  margin: 0 0 4px;
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.25;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 6px 10px 8px;
  gap: 4px;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .cad-form-fields {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}
#viewCadastro.is-nfe-entrada.cad-mode-form .nfe-sefaz-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 6px;
}
/* Vínculo: sobe o quadro da NF (sem título duplicado da ficha) */
#viewCadastro.is-nfe-entrada-vinculo .cad-form-head {
  display: none;
}
#viewCadastro.is-nfe-entrada-vinculo .cad-head > div:first-child {
  display: none;
}
#viewCadastro.is-nfe-entrada-vinculo .cad-head {
  margin: 0 0 2px;
  min-height: 0;
}
#viewCadastro.is-nfe-entrada-vinculo .cad-actions #btnSalvar,
#viewCadastro.is-nfe-entrada-vinculo .cad-actions #btnNovo {
  display: none;
}
#viewCadastro.is-nfe-entrada-vinculo .cad-actions #btnVoltarLista {
  display: inline-flex;
}
#viewCadastro.is-nfe-entrada-vinculo .status-line {
  margin: 0 0 2px;
  min-height: 0;
  font-size: 0.75rem;
}
#viewCadastro.is-nfe-entrada-vinculo #nfeEntradaVinculoWrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  gap: 4px;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-quadro-cab {
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-quadro-conf {
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-lista {
  min-height: 0 !important;
  max-height: none !important;
  height: auto;
  overflow: auto;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-meta-compact {
  margin: 0 !important;
  max-height: none !important;
  overflow: visible;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-fornec {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-dups-inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
#viewCadastro.is-nfe-entrada-vinculo .nfe-ent-totais {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-top: 3px;
}
#viewCadastro.is-nfe-entrada-vinculo .menu-access-note,
#viewCadastro.is-nfe-entrada-vinculo #nfeEntradaImportActions,
#viewCadastro.is-nfe-entrada-vinculo #nfeEntradaPathMeta,
#viewCadastro.is-nfe-entrada-vinculo #nfeEntradaListaWrap,
#viewCadastro.is-nfe-entrada-vinculo #nfeEntradaVoltarBar {
  display: none !important;
}

.nfe-ent-sec {
  min-width: 0;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.nfe-ent-dl {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 2px 8px;
  margin: 0;
  font-size: 0.78rem;
  align-items: start;
}
.nfe-ent-dl dt {
  color: #556;
  font-weight: 600;
  line-height: 1.2;
}
.nfe-ent-dl dd {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.nfe-ent-qtd-cell {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  white-space: nowrap;
}
.nfe-ent-qtd-fator {
  font-size: 0.68rem;
  line-height: 1;
}
.nfe-ent-col-estoque {
  min-width: 5.2rem;
}
.nfe-ent-col-vincule {
  white-space: nowrap;
  vertical-align: middle !important;
}
.nfe-ent-qtd-input {
  width: 4.6rem;
  max-width: 100%;
  min-height: 18px !important;
  height: 18px !important;
  padding: 0 4px !important;
  border: 1px solid #9bb0c8;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem !important;
  text-align: right;
}
.nfe-ent-qtd-destaque {
  font-weight: 700;
  background: #fff;
  border-color: #3d6ea5;
}
.nfe-ent-itens-table {
  table-layout: fixed;
  width: 100%;
}
.nfe-ent-itens-table col.nfe-ent-col-it { width: 2.2rem; }
.nfe-ent-itens-table col.nfe-ent-col-xml { width: 11%; }
.nfe-ent-itens-table col.nfe-ent-col-desc { width: auto; }
.nfe-ent-itens-table col.nfe-ent-col-und { width: 2.8rem; }
.nfe-ent-itens-table col.nfe-ent-col-qxml { width: 5.6rem; }
.nfe-ent-itens-table col.nfe-ent-col-qest { width: 5.8rem; }
.nfe-ent-itens-table col.nfe-ent-col-custo { width: 6.2rem; }
.nfe-ent-itens-table col.nfe-ent-col-total { width: 6.2rem; }
.nfe-ent-itens-table col.nfe-ent-col-prod { width: 13%; }
.nfe-ent-itens-table col.nfe-ent-col-vinc { width: 6.8rem; }
.nfe-ent-itens-table th,
.nfe-ent-itens-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nfe-ent-ellip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}
.nfe-ent-custo-un {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.nfe-ent-custo-un.is-convertido {
  color: #0f766e;
  background: #ecfdf5;
}
.nfe-ent-custo-linha {
  margin: 0;
  font-size: 0.78rem;
  color: #334155;
}
.nfe-ent-col-vincule .btn {
  padding: 1px 6px;
  min-height: 20px;
  font-size: 0.72rem;
}
.nfe-ent-itens-table td.nfe-ent-col-vincule {
  overflow: visible;
}
.nfe-sefaz-table td.col-num,
.nfe-sefaz-table th.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nfe-sefaz-table tr.is-selected {
  background: #eef8f0;
}
.nfe-sefaz-table .muted {
  color: #778;
  text-align: center;
  padding: 18px;
}

/* Resumo Conta Azul ? contas a receber (compacto) */
.titulo-resumo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  padding: 0;
  margin-bottom: 8px;
  overflow: hidden;
}

.titulo-resumo-period {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-right: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fafafa;
}

.titulo-resumo-empresa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.titulo-resumo-empresa select {
  min-width: 180px;
  max-width: 280px;
  height: 28px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  padding: 0 6px;
}

.titulo-resumo-period-label {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.titulo-resumo-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.titulo-resumo-nav-btn,
.titulo-resumo-month-btn {
  font: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #1f2937;
}

.titulo-resumo-nav-btn {
  width: 26px;
  height: 26px;
  font-size: 16px;
  line-height: 1;
  color: #4b5563;
}

.titulo-resumo-nav-btn:hover,
.titulo-resumo-month-btn:hover {
  background: #f3f4f6;
}

.titulo-resumo-month-btn {
  min-width: 118px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
}

.titulo-resumo-clear {
  border: 0;
  background: transparent;
  color: #9ca3af;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
}

.titulo-resumo-clear:hover {
  color: #dc2626;
}

.ov-resumo-bar {
  margin: 0 0 8px;
  flex: 0 0 auto;
}

#viewCadastro.is-ordens-venda .ordens-venda-toolbar {
  display: grid;
  grid-template-columns: 7.4rem 7.4rem 8.6rem 7.2rem 8.4rem minmax(7.5rem, 11rem) minmax(8rem, 1.4fr) auto;
  gap: 4px 8px;
  align-items: end;
  padding: 0 0 8px;
}

#viewCadastro.is-ordens-venda .ordens-venda-toolbar label {
  min-width: 0;
}

#viewCadastro.is-ordens-venda .ordens-venda-toolbar input,
#viewCadastro.is-ordens-venda .ordens-venda-toolbar select {
  min-width: 0;
  width: 100%;
  padding: 4px 6px;
  font-size: 0.8rem;
}

#viewCadastro.is-ordens-venda .ordens-venda-toolbar .ov-cliente-lookup input[type='text'] {
  min-width: 0;
  max-width: none;
}

.ov-resumo-bar .titulo-resumo-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ov-resumo-qtd {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
}

.titulo-resumo-metric.is-active .ov-resumo-qtd {
  color: #1d4ed8;
}

.titulo-resumo-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  flex: 1;
  min-width: 0;
}

.titulo-resumo-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px;
  border: 0;
  border-right: 1px solid #e5e7eb;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  min-height: 44px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.titulo-resumo-metric:last-child {
  border-right: 0;
}

.titulo-resumo-metric:hover {
  background: #f9fafb;
}

.titulo-resumo-metric.is-active {
  border-bottom-color: #2563eb;
  background: #f8fafc;
}

.titulo-resumo-metric-label {
  font-size: 10px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

.titulo-resumo-metric-value {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1e40af;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.titulo-resumo-metric.is-danger .titulo-resumo-metric-value {
  color: #dc2626;
}

.titulo-resumo-metric.is-success .titulo-resumo-metric-value {
  color: #16a34a;
}

.titulo-resumo-metric.is-info .titulo-resumo-metric-value {
  color: #2563eb;
}

#viewCadastro.cad-mode-list.has-titulo-resumo .cad-list-head {
  display: none;
}

#viewCadastro.cad-mode-list.has-titulo-resumo .cad-search-panel {
  padding: 8px 10px 6px;
  margin-bottom: 8px;
}

@media (max-width: 1100px) {
  .titulo-resumo-bar {
    flex-direction: column;
  }
  .titulo-resumo-period {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
  }
}

@media (max-width: 700px) {
  .titulo-resumo-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .titulo-resumo-metric {
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
  }
  .titulo-resumo-metric.is-active {
    border-bottom-color: #2563eb;
  }
}

/* —— Dashboard PDV (layout referência) —— */
#viewCadastro.is-pdv-dash.cad-mode-form,
#viewCadastro.is-demonstrativo.cad-mode-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-head .eyebrow,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-head .eyebrow {
  display: none;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-head h2,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-head h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-actions #btnSalvar,
#viewCadastro.is-pdv-dash.cad-mode-form .cad-actions #btnNovo,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-actions #btnNovo {
  display: none !important;
}

#viewCadastro.is-pdv-dash.cad-mode-form .status-line,
#viewCadastro.is-demonstrativo.cad-mode-form .status-line {
  flex: 0 0 auto;
  margin: 0 0 6px;
  min-height: 0;
  font-size: 0.78rem;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-layout,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-form,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: #f4f6f8;
  border: 0;
  box-shadow: none;
  padding: 4px 8px 16px;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-form-head,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-form-head {
  display: none;
}

#viewCadastro.is-pdv-dash.cad-mode-form .cad-form-fields,
#viewCadastro.is-demonstrativo.cad-mode-form .cad-form-fields {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.pdv-dash-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 8px 12px;
  max-width: 1280px;
}

.pdv-dash-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}

.pdv-dash-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1f2937;
  font-family: var(--font-ui);
}

.pdv-dash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: flex-end;
}

.pdv-dash-filters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pdv-dash-filters label span {
  font-size: 0.68rem;
  color: #6b7280;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pdv-dash-filters select,
.pdv-dash-filters input[type="date"] {
  min-width: 128px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: #111827;
  height: 38px;
}

.pdv-dash-search {
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.pdv-dash-search:hover {
  background: #1d4ed8;
}

.pdv-dash-import {
  background: #334155;
}

.pdv-dash-import:hover {
  background: #1e293b;
}

.pdv-dash-process {
  background: #0f6b5c;
}

.pdv-dash-process:hover {
  background: #0b5347;
}

.pdv-dash-audit {
  background: #7c2d12;
}

.pdv-dash-audit:hover {
  background: #9a3412;
}

.pdv-dash-audit-panel {
  margin-top: 4px;
}

.pdv-dash-audit-body {
  font-size: 0.85rem;
}

.pdv-audit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.pdv-audit-summary .sev-alta { color: #b91c1c; font-weight: 700; }
.pdv-audit-summary .sev-media { color: #c2410c; font-weight: 650; }
.pdv-audit-summary .sev-baixa { color: #a16207; }

.pdv-audit-table-wrap {
  overflow: auto;
  max-height: 280px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.pdv-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.pdv-audit-table th,
.pdv-audit-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.pdv-audit-table tr.sev-alta td:first-child { color: #b91c1c; font-weight: 700; }
.pdv-audit-table tr.sev-media td:first-child { color: #c2410c; font-weight: 650; }
.pdv-audit-table .tiny { font-size: 0.72rem; margin-top: 2px; }
.pdv-dash-audit-panel h5 {
  margin: 8px 0 6px;
  font-size: 0.85rem;
}
.pdv-dash-audit-panel .ok-msg {
  color: #0f6b5c;
  font-weight: 600;
}

.pdv-dash-meta {
  font-size: var(--fs-xs);
  color: #94a3b8;
}

.pdv-dash-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.pdv-kpi {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 96px;
}

.pdv-kpi-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.pdv-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.pdv-kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.pdv-kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  background: #eff6ff;
  color: #2563eb;
}

.pdv-kpi.is-blue .pdv-kpi-label { color: #2563eb; }
.pdv-kpi.is-blue .pdv-kpi-ico { background: #eff6ff; color: #2563eb; }

.pdv-kpi.is-red .pdv-kpi-label { color: #dc2626; }
.pdv-kpi.is-red .pdv-kpi-ico { background: #fef2f2; color: #dc2626; }

.pdv-kpi.is-green .pdv-kpi-label { color: #16a34a; }
.pdv-kpi.is-green .pdv-kpi-ico { background: #f0fdf4; color: #16a34a; }

.pdv-kpi.is-amber .pdv-kpi-label { color: #d97706; }
.pdv-kpi.is-amber .pdv-kpi-ico { background: #fffbeb; color: #d97706; }

.pdv-dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr) minmax(280px, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.pdv-dash-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.pdv-dash-card h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.pdv-dash-chart,
.pdv-dash-pag,
.pdv-dash-top {
  flex: 1;
  min-height: 0;
}

.pdv-line-svg {
  width: 100%;
  height: auto;
  max-height: 300px;
  display: block;
}

.pdv-chart-grid {
  stroke: #eef2f7;
  stroke-width: 1;
}

.pdv-chart-axis {
  fill: #94a3b8;
  font-size: 11px;
  font-family: var(--font-ui);
}

.pdv-chart-area {
  fill: rgba(249, 115, 22, 0.16);
}

.pdv-chart-line {
  stroke: #f97316;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pdv-chart-dot {
  fill: #f97316;
  stroke: #fff;
  stroke-width: 1.5;
}

.pdv-pag-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.pdv-donut-svg {
  width: 168px;
  height: 168px;
  flex-shrink: 0;
}

.pdv-pag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdv-pag-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.84rem;
}

.pdv-pag-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.pdv-pag-name {
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdv-pag-val {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  font-weight: 650;
}

.pdv-top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow: auto;
}

.pdv-top-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.pdv-top-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdv-top-cod {
  font-size: 0.72rem;
  color: #94a3b8;
}

.pdv-top-nome {
  font-size: 0.84rem;
  color: #0f172a;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.pdv-top-qtd {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pdv-top-track {
  margin-top: 6px;
  height: 5px;
  border-radius: 999px;
  background: #fee2e2;
  overflow: hidden;
}

.pdv-top-fill {
  height: 100%;
  border-radius: inherit;
  background: #ef4444;
}

@media (max-width: 1100px) {
  .pdv-dash-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pdv-dash-desempenho {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .pdv-dash-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .pdv-dash-grid {
    grid-template-columns: 1fr;
  }
  .pdv-dash-desempenho {
    grid-column: auto;
  }
  .pdv-dash-kpis {
    grid-template-columns: 1fr;
  }
  .pdv-dash-card {
    min-height: 0;
  }
  .pdv-top-nome {
    max-width: 160px;
  }
}

/* Ordens de Fatura / Ordem de Compra / NF Saída */
#viewCadastro.is-ordens-venda.cad-mode-form,
#viewCadastro.is-ordens-compra.cad-mode-form,
#viewCadastro.is-nfe-saida.cad-mode-form,
#viewCadastro.is-cte-mdfe.cad-mode-form,
#viewCadastro.is-nfse.cad-mode-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#viewCadastro.is-ordens-venda.cad-mode-form .cad-actions #btnSalvar,
#viewCadastro.is-ordens-venda.cad-mode-form .cad-actions #btnNovo,
#viewCadastro.is-ordens-compra.cad-mode-form .cad-actions #btnSalvar,
#viewCadastro.is-ordens-compra.cad-mode-form .cad-actions #btnNovo {
  display: none;
}

#viewCadastro.is-ordens-venda.cad-mode-form .cad-layout,
#viewCadastro.is-ordens-compra.cad-mode-form .cad-layout,
#viewCadastro.is-nfe-saida.cad-mode-form .cad-layout,
#viewCadastro.is-cte-mdfe.cad-mode-form .cad-layout,
#viewCadastro.is-nfse.cad-mode-form .cad-layout {
  flex: 1;
  min-height: 0;
}

#viewCadastro.is-ordens-venda.cad-mode-form .cad-form-head,
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form-head {
  display: none;
}

#viewCadastro.is-ordens-venda.cad-mode-form .cad-form,
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form,
#viewCadastro.is-nfe-saida.cad-mode-form .cad-form,
#viewCadastro.is-cte-mdfe.cad-mode-form .cad-form,
#viewCadastro.is-nfse.cad-mode-form .cad-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

#viewCadastro.is-ordens-compra.cad-mode-form {
  overflow: hidden;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-head {
  flex: 0 0 auto;
  margin-bottom: 2px;
  gap: 8px;
  align-items: center;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-head .eyebrow {
  display: none;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-head h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 8px;
  gap: 6px;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form-head {
  flex: 0 0 auto;
  min-height: 0;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form-head h3 {
  font-size: 1rem;
  margin: 0;
}
#viewCadastro.is-ordens-compra.cad-mode-form .cad-form-fields {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
}
#viewCadastro.is-ordens-compra .ordens-venda-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 6px;
}
#viewCadastro.is-ordens-compra .oc-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 0 0 6px;
}
#viewCadastro.is-ordens-compra .ov-toolbar-filtros {
  display: grid;
  grid-template-columns: 8rem 8rem 7.2rem 8.2rem 9.5rem minmax(9rem, 1.5fr) auto;
  gap: 4px 8px;
  align-items: end;
  min-width: 0;
}
#viewCadastro.is-ordens-compra .ov-toolbar-filtros label {
  min-width: 0;
}
#viewCadastro.is-ordens-compra .oc-toolbar input,
#viewCadastro.is-ordens-compra .oc-toolbar select {
  min-width: 0;
  width: 100%;
  padding: 4px 6px;
  font-size: 0.8rem;
}
#viewCadastro.is-ordens-compra .oc-filtro-forn {
  min-width: 0;
}
#viewCadastro.is-ordens-compra .oc-filtro-forn .lookup-input-wrap input[type='text'] {
  min-width: 0;
  max-width: none;
}
#viewCadastro.is-ordens-compra .oc-filtro-forn .lookup-desc {
  max-width: 100%;
  line-height: 1.15;
}
#viewCadastro.is-ordens-compra .ov-toolbar-acoes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#viewCadastro.is-ordens-compra .ordens-venda-panel.is-oc-detalhe .ov-toolbar-filtros {
  display: none;
}
#viewCadastro.is-ordens-compra #oc_lista_wrap,
#viewCadastro.is-ordens-compra #oc_detalhe_wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#viewCadastro.is-ordens-compra #oc_lista_wrap[hidden],
#viewCadastro.is-ordens-compra #oc_detalhe_wrap[hidden],
#viewCadastro.is-ordens-compra .ordens-venda-panel.is-oc-detalhe #oc_lista_wrap {
  display: none !important;
}
#viewCadastro.is-ordens-compra #oc_lista_wrap .ordens-venda-table-wrap {
  flex: 1;
  min-height: 0;
}
#viewCadastro.is-ordens-compra #oc_lista_meta {
  flex: 0 0 auto;
  margin: 4px 0 0;
}
#viewCadastro.is-ordens-compra .oc-detalhe {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(140px, 1fr) auto;
  gap: 6px;
  overflow: hidden;
}
#viewCadastro.is-ordens-compra .oc-detalhe .ordens-venda-cab h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}
#viewCadastro.is-ordens-compra .oc-cab-dl {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px 10px;
  margin: 0;
}
#viewCadastro.is-ordens-compra .oc-cab-dl .oc-cab-forn {
  grid-column: span 2;
}
#viewCadastro.is-ordens-compra .oc-cab-dl dt {
  font-size: 0.65rem;
}
#viewCadastro.is-ordens-compra .oc-cab-dl dd {
  margin: 1px 0 0;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#viewCadastro.is-ordens-compra .oc-detalhe-itens {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#viewCadastro.is-ordens-compra .oc-detalhe-itens h5 {
  margin: 0 0 4px;
}
#viewCadastro.is-ordens-compra .oc-detalhe-itens .ordens-venda-table-wrap {
  flex: 1;
  min-height: 0;
}
#viewCadastro.is-ordens-compra .oc-detalhe-extras {
  max-height: min(32vh, 260px);
  overflow: auto;
  border-top: 1px solid #e5e7eb;
  padding-top: 6px;
}
#viewCadastro.is-ordens-compra .oc-detalhe-extras h5 {
  margin: 8px 0 4px;
}
#viewCadastro.is-ordens-compra .oc-detalhe-extras h5:first-child {
  margin-top: 0;
}
#viewCadastro.is-ordens-compra .oc-detalhe-extras .muted.tiny {
  display: none;
}
@media (max-width: 1200px) {
  #viewCadastro.is-ordens-compra .ov-toolbar-filtros {
    grid-template-columns: 7.4rem 7.4rem 6.8rem 7.6rem minmax(8rem, 1fr);
  }
  #viewCadastro.is-ordens-compra .oc-filtro-busca,
  #viewCadastro.is-ordens-compra #oc_btn_pesquisar {
    grid-column: auto;
  }
  #viewCadastro.is-ordens-compra .oc-cab-dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.ordens-venda-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 4px 0 8px;
  border-bottom: 1px solid #e5e7eb;
}

.ordens-venda-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 650;
  color: #475569;
}

.ordens-venda-toolbar input,
.ordens-venda-toolbar select {
  min-width: 9rem;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
}

.ordens-venda-toolbar input[type='search'] {
  min-width: 16rem;
}

.ordens-venda-toolbar .ov-cliente-lookup {
  min-width: 12rem;
}

.ordens-venda-toolbar .ov-cliente-lookup .lookup-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ordens-venda-toolbar .ov-cliente-lookup input[type='text'] {
  min-width: 6.5rem;
  max-width: 8.5rem;
}

.ordens-venda-toolbar .ov-cliente-lookup .btn-lookup {
  flex: 0 0 auto;
  padding: 5px 8px;
  line-height: 1;
}

.ordens-venda-toolbar .ov-cliente-lookup .lookup-desc {
  font-weight: 500;
  font-size: 0.72rem;
  color: #64748b;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ordens-venda-table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.ordens-venda-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-browse);
}

.ordens-venda-table th,
.ordens-venda-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  white-space: nowrap;
}

.ordens-venda-table th {
  background: #f8fafc;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ordens-venda-table td.num,
.ordens-venda-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ordens-venda-row {
  cursor: pointer;
}

.ordens-venda-row:hover td {
  background: #f1f5f9;
}

.ov-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ov-badge-pdv {
  background: #ecfdf5;
  color: #047857;
}

.ov-badge-ped {
  background: #eff6ff;
  color: #1d4ed8;
}

.ov-badge-transf {
  background: #fef3c7;
  color: #b45309;
}

.ov-badge-bonif {
  background: #f3e8ff;
  color: #7e22ce;
}

.ov-badge-perda {
  background: #fee2e2;
  color: #b91c1c;
}

.ov-badge-out {
  background: #f8fafc;
  color: #64748b;
}

.ordens-venda-toolbar .btn.secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 0;
}

.ordens-venda-toolbar .btn.ov-btn-imprime {
  background: #2563eb;
  color: #fff;
  border: 0;
  font-weight: 650;
}

.ordens-venda-toolbar .btn.ov-btn-imprime:hover {
  background: #1d4ed8;
}

.ordens-venda-toolbar .btn.ov-btn-cancela {
  background: #b91c1c;
  color: #fff;
  border: 0;
  font-weight: 650;
}

.ordens-venda-toolbar .btn.ov-btn-cancela:hover {
  background: #991b1b;
}

.ordens-venda-vincula-nf {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin: 0 0 16px;
  padding: 12px 0 0;
  border-top: 1px solid #e2e8f0;
}

.ordens-venda-vincula-nf label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 650;
  color: #475569;
}

.ordens-venda-vincula-nf input {
  min-width: 160px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
}

.ordens-venda-toolbar .btn.ov-btn-vincula-nf,
.ordens-venda-vincula-nf .btn.ov-btn-vincula-nf {
  background: #0f766e;
  color: #fff;
  border: 0;
  font-weight: 650;
  padding: 7px 14px;
}

.ordens-venda-vincula-nf .btn.ov-btn-vincula-nf:hover {
  background: #0d9488;
}

.ordens-venda-lote-nf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.ordens-venda-lote-nf[hidden] {
  display: none !important;
}

.ordens-venda-table .ov-col-check {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.ordens-venda-table .ov-col-check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.ordens-venda-vincula-nf .btn.ov-btn-reabre-nf,
.ordens-venda-lote-nf .btn.ov-btn-reabre-nf {
  background: #b45309;
  color: #fff;
  border: 0;
  font-weight: 650;
  padding: 7px 14px;
}

.ordens-venda-lote-nf .btn.ov-btn-reabre-nf:hover {
  background: #d97706;
}

.ov-stanfs {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.ov-stanfs-s {
  background: #dcfce7;
  color: #166534;
}

.ov-stanfs-p {
  background: #ffedd5;
  color: #9a3412;
}

.ov-stanfs-a {
  background: #e2e8f0;
  color: #334155;
}

.ordens-venda-cab h4 {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
}

.ordens-venda-dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 16px;
  margin: 0 0 16px;
}

.ordens-venda-dl dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
}

.ordens-venda-dl dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: #0f172a;
}

.ordens-venda-detalhe-wrap h5 {
  margin: 16px 0 8px;
  font-size: 0.9rem;
}

.oc-mvtipo-1 {
  background: #dcfce7;
  color: #166534;
}

.oc-mvtipo-out {
  background: #fee2e2;
  color: #b91c1c;
}

.ped-analise-dialog {
  width: min(1180px, 98vw);
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.ped-analise-dialog .lookup-dialog-head {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.ped-analise-dialog .form-note {
  flex: 0 0 auto;
  line-height: 1.45;
  font-size: 0.78rem;
}

.ped-analise-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.ped-analise-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}

.ped-analise-table {
  font-size: 12px;
  margin: 0;
}

.ped-analise-table th {
  position: sticky;
  top: 0;
  background: #e8f0fe;
  z-index: 1;
}

.ped-analise-desc {
  max-width: 220px;
  white-space: normal;
}

.ped-analise-sug {
  background: #e8f8ef;
  font-weight: 700;
}

.ped-analise-resumo {
  margin-bottom: 12px;
  font-size: 12px;
}

.ped-analise-item-head {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.ped-analise-mov-wrap {
  max-height: 42vh;
}

/* —— Demonstrativos Financeiro —— */
.dem-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 4px 16px;
  max-width: 1400px;
}

.dem-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.dem-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f4c5c;
  min-width: 220px;
}

.dem-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}

.dem-filters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #4b5563;
}

.dem-filters label span {
  font-weight: 600;
}

.dem-filters select,
.dem-filters input[type="date"] {
  min-width: 140px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.dem-filters .dem-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  height: 32px;
  font-size: 12px;
}

.dem-search {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.dem-search:hover {
  background: #0d5f59;
}

.dem-print {
  background: #0f3d67;
}

.dem-print:hover {
  background: #0c3254;
}

.dem-note {
  margin: 0;
  font-size: 12px;
  color: #334155;
}

.dem-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dem-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.dem-kpi {
  background: #fff;
  border: 1px solid #dbe4ea;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dem-kpi span {
  font-size: 11px;
  color: #334155;
  font-weight: 700;
}

.dem-kpi strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.dem-kpi-main {
  border-color: #0f766e;
  background: #f0fdfa;
}

.dem-kpi-warn {
  border-color: #f59e0b;
}

.dem-kpi-sub {
  font-size: 11px;
  font-style: normal;
  color: #64748b;
}

.dem-row-neg td {
  background: #fdecea;
}

.dem-row-apertado td {
  background: #fff7ed;
}

.dem-row-proj td {
  background: #f5f3ff;
}

.dem-row-proj-sep td {
  background: #ede9fe;
  font-weight: 700;
  color: #5b21b6;
}

.dem-tag-proj {
  font-size: 10px;
  background: #ede9fe;
  color: #5b21b6;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.dem-card {
  background: #fff;
  border: 1px solid #dbe4ea;
  border-radius: 8px;
  padding: 12px 14px 8px;
}

.dem-card h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #0f172a;
  font-weight: 700;
}

.dem-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dem-table-wrap {
  overflow: auto;
  max-height: 52vh;
}

.dem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #1e2937;
}

.dem-table th,
.dem-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #d5dbe3;
  white-space: nowrap;
}

.dem-table th {
  position: sticky;
  top: 0;
  background: #5d6b75;
  color: #fff;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  z-index: 2;
}

.dem-table .num,
.dem-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dem-table tfoot th {
  background: #e8eef0;
  color: #1e2937;
  font-weight: 700;
}

.dem-table tr.is-destaque td {
  font-weight: 700;
  background: #f0fdfa;
}

.dem-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 6px;
  white-space: nowrap;
}

.dem-tag-despesa {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.dem-tag-compra {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.dem-tag-alerta {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fdba74;
}

.dem-subconta {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  background: #fafbfd;
}

.dem-subconta-alerta {
  border-color: #fdba74;
  background: #fffbeb;
}

.dem-subconta-h {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.dem-table tr.dem-row-alerta td {
  background: #fff7ed;
}

.dem-linhas {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dem-linha {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
  border-bottom: 1px dotted #e5e7eb;
  font-size: 13px;
}

.dem-linha.is-destaque {
  font-weight: 700;
  background: #f0fdfa;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  margin-top: 4px;
}

.dem-perc {
  margin-left: 8px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.dem-pos { color: #047857; }
.dem-neg { color: #b91c1c; }
.dem-erro { color: #b91c1c; font-weight: 600; }

@media (max-width: 900px) {
  .dem-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Estoque → Movimentação de Produtos */
#viewCadastro.is-mov-produtos.cad-mode-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-head .eyebrow {
  display: none;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-head h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-actions #btnNovo {
  display: none !important;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-layout,
#viewCadastro.is-mov-produtos.cad-mode-form .cad-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-form-head {
  display: none;
}
#viewCadastro.is-mov-produtos.cad-mode-form .cad-form-fields {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mp-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 8px;
}
.mp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: end;
}
.mp-filters label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #334155;
}
.mp-filters label[hidden] {
  display: none !important;
}
.mp-filters label span {
  font-weight: 600;
}
.mp-filters input,
.mp-filters select {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid #c5cdd6;
  border-radius: 4px;
  min-width: 8rem;
}
.mp-filters .mp-prod input {
  min-width: 14rem;
}
.mp-check {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  padding-bottom: 6px;
}
.mp-search {
  font: inherit;
  padding: 6px 12px;
  cursor: pointer;
  background: #1d4ed8;
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-weight: 600;
}
.mp-search.mp-print {
  background: #475569;
}
.mp-search.mp-pdf {
  background: #0f766e;
}
.mp-note {
  margin: 0;
  font-size: 12px;
}
.mp-warn { color: #b45309; font-weight: 600; }
.mp-erro { color: #b91c1c; font-weight: 600; }
.mp-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mp-kpi {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 8.5rem;
}
.mp-kpi span {
  display: block;
  font-size: 11px;
  color: #64748b;
}
.mp-kpi b {
  font-size: 14px;
  color: #0f172a;
}
.mp-abc-ask {
  margin: 16px 0 8px;
}
.mp-abc-ask-card {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px 14px;
}
.mp-abc-ask-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.mp-abc-ask-card h4 {
  margin: 12px 0 6px;
  font-size: 13px;
}
.mp-abc-regras {
  margin: 0 0 12px;
}
.mp-abc-regras table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mp-abc-regras th,
.mp-abc-regras td {
  border-bottom: 1px solid #d5dbe3;
  padding: 5px 6px;
  text-align: left;
  vertical-align: top;
}
.mp-abc-ask-card p {
  margin: 0 0 10px;
  font-size: 13px;
}
.mp-abc-ask-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.mp-abc-ask-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #475569;
}
.mp-abc-ask-fields input {
  font: inherit;
  padding: 6px 8px;
  min-width: 10rem;
  border: 1px solid #94a3b8;
  border-radius: 4px;
}
.mp-campanha-body {
  margin-top: 16px;
}
.mp-campanha-body h3,
.mp-campanha-body h4 {
  margin: 12px 0 6px;
}
.mp-campanha-body .abc-embaso {
  margin-top: 8px;
}
.abc-grafico {
  margin: 22px 0 8px;
  padding-top: 12px;
  border-top: 2px solid #0f172a;
}
.abc-grafico h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.abc-graf-totais {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 14px;
}
.abc-graf-tot {
  flex: 1;
  min-width: 180px;
  background: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #dde3ea;
}
.abc-graf-tot span {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}
.abc-graf-tot b {
  font-size: 18px;
}
.abc-graf-tot b.azul { color: #36a2eb; }
.abc-graf-tot b.verm { color: #ff6384; }
.abc-graf-tot b.amar { color: #c99700; }
.abc-graf-leg {
  font-size: 13px;
  margin-bottom: 8px;
}
.abc-graf-leg span {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0 6px 0 10px;
  vertical-align: middle;
}
.abc-leg-azul { background: #36a2eb; }
.abc-leg-verm { background: #ff6384; }
.abc-leg-amar { background: #ffce56; }
.abc-graf-nav {
  margin-bottom: 10px;
}
.abc-graf-btn {
  font-size: 13px;
  padding: 5px 12px;
  margin: 0 5px 6px 0;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
}
.abc-graf-btn.ativo {
  background: #36a2eb;
  color: #fff;
  border-color: #36a2eb;
}
.abc-graf-wrap {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
  overflow-x: auto;
}
.mp-kpi.mp-ent b { color: #047857; }
.mp-kpi.mp-sai b { color: #b91c1c; }
.mp-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.mp-table-wrap {
  overflow: auto;
  max-height: 100%;
}
.mp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #1e2937;
}
.mp-table th,
.mp-table td {
  padding: 5px 7px;
  border-bottom: 1px solid #d5dbe3;
  white-space: nowrap;
}
.mp-table th {
  position: sticky;
  top: 0;
  background: #5d6b75;
  color: #fff;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}
.mp-table .num,
.mp-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mp-table td.mp-desc {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-table tr.mp-ent td { background: #f0fdf4; }
.mp-table tr.mp-sai td { background: #fef2f2; }
.mp-table tr.mp-can td { background: #f8fafc; color: #64748b; }
.mp-table tr.frn-row.is-sel td { background: #dbeafe; }
.mp-table tr.mp-subtotal td { background: #eef2f6; font-weight: 700; }
.cr-ped-linha {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}
.cr-comprador {
  color: #1565c0;
  font-weight: 700;
  white-space: nowrap;
}
.mp-table td.mp-margem-ok { color: #047857; font-weight: 600; }
.mp-table td.mp-margem-neg { color: #b91c1c; font-weight: 600; }
.mp-kpi.mp-margem-ok b { color: #047857; }
.mp-kpi.mp-margem-neg b { color: #b91c1c; }
.mp-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #e2e8f0;
}
.mp-badge.mp-ent { background: #d1fae5; color: #065f46; }
.mp-badge.mp-sai { background: #fee2e2; color: #991b1b; }
.mp-badge.mp-can { background: #e2e8f0; color: #475569; }

.mp-filters label.has-lookup {
  min-width: 11rem;
}
.mp-filters .er-emp-lookup {
  min-width: 16rem;
}
.mp-filters .lookup-input-wrap input {
  min-width: 7rem;
}
.mp-filters .er-emp-lookup .lookup-input-wrap input {
  min-width: 6rem;
  text-transform: uppercase;
}
#er_grupo_overlay {
  z-index: 60;
}
.lookup-item.is-selected {
  background: rgba(29, 78, 216, 0.1);
}
.lookup-item.er-item-todas strong {
  color: #0f766e;
}
.er-emp-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
}
.tr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 4px 0 12px;
}
.tr-field {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
}
.tr-field span {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}
.tr-field b {
  display: block;
  font-size: 14px;
  margin-top: 2px;
  word-break: break-all;
}
.tr-progress {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.tr-progress > i {
  display: block;
  height: 100%;
  background: #0d9488;
  width: 0;
  transition: width 0.2s ease;
}
.tr-json {
  font-size: 12px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}

.lote-pick-overlay .lote-pick-dialog {
  max-width: 820px;
  width: min(820px, 96vw);
}
.lote-pick-body {
  max-height: 58vh;
  overflow: auto;
  padding: 0 4px 8px;
}
.lote-pick-item {
  margin-bottom: 14px;
}
.lote-pick-item h4 {
  margin: 8px 0 6px;
  font-size: 13px;
}
.lote-pick-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 8px 4px 0;
}
.lote-new-box,
.lote-mov-box,
.rm-pedido-box {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #d5e0ec;
}
.lote-pick-qtd {
  width: 90px;
}

.pdv-carga-note {
  margin: 0;
  font-size: 0.85rem;
}

.pdv-carga-table-wrap,
.pdv-carga-acks {
  overflow: auto;
}

.pdv-carga-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pdv-carga-table th,
.pdv-carga-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

.pdv-carga-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.pdv-carga-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pdv-carga-table tbody tr:hover {
  background: #f8fafc;
}

.pdv-carga-ack-table {
  margin-bottom: 8px;
}

#viewCadastro.is-pdv-carga .pdv-dash-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.pdv-carga-vinc-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 10px 0 14px;
}

.pdv-carga-vinc-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: #64748b;
}

.pdv-carga-vinc-form label.wide {
  grid-column: span 2;
}

.pdv-carga-vinc-form input,
.pdv-carga-vinc-form select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #d5e0ec;
  border-radius: 6px;
  background: #fff;
}

.pdv-carga-vinc-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdv-vinc-row {
  cursor: pointer;
}

.pdv-carga-teste {
  margin-bottom: 12px;
}

.iu-file input[type="file"] {
  min-width: 16rem;
}

.iu-inv-grid {
  margin: 4px 0 8px;
}

body.is-menu-compact .acc-mod:not([data-module-id="utilitarios"]) {
  display: none;
}

.inv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
.inv-tab {
  border: 1px solid var(--line, #ccd);
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
.inv-tab.is-active {
  background: #f5d76e;
  border-color: #e0c040;
  font-weight: 600;
}






