﻿:root {
  --ink: #18212f;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #eef3f7;
  --blue: #0b6b95;
  --green: #2d7c4b;
  --amber: #b98522;
  --sidebar: #1f405f;
}

html {
  font-size: 14px;
}

body {
  color: var(--ink);
  background: var(--page);
  margin: 0;
}

a {
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 310px 1fr;
}

.sidebar {
  background: var(--sidebar);
  color: #fff;
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  transition: width .2s ease, transform .2s ease;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.16);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  display: grid;
  place-items: center;
}

.icon-button {
  border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.08);
  color: inherit;
  border-radius: 6px;
  min-width: 38px;
  height: 38px;
}

.side-menu {
  overflow-y: auto;
  padding: 10px;
}

.side-menu details {
  margin-bottom: 7px;
}

.side-menu summary {
  cursor: pointer;
  color: #d6ecff;
  padding: 9px 10px;
  font-weight: 700;
}

.side-menu a {
  display: grid;
  color: #f7fbff;
  padding: 8px 10px;
  margin: 3px 0;
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.menu-children {
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.16);
  margin-left: 10px;
}

.menu-children details {
  margin-bottom: 3px;
}

.menu-children summary {
  font-weight: 600;
  color: #eaf6ff;
}

.menu-disabled {
  display: block;
  padding: 8px 10px;
  color: #98b6ca;
  opacity: .78;
}

.side-menu a:hover {
  background: rgba(255,255,255,.1);
  border-left-color: #87d3ff;
}

.side-menu a.is-active {
  background: rgba(255,255,255,.14);
  border-left-color: #87d3ff;
  font-weight: 700;
}

.side-menu small {
  color: #b8d3e7;
  font-size: .78rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.16);
}

.sidebar-footer a {
  color: #fff;
}

.main-frame {
  min-width: 0;
}

.topbar {
  min-height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
}

.mobile-menu {
  display: none;
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink) !important;
}

.content-frame {
  padding: 18px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head h1 {
  font-size: 1.7rem;
  margin: 0 0 4px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.page-head small {
  color: var(--muted);
}

.eyebrow {
  color: var(--green) !important;
  font-weight: 700;
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-grid section,
.work-panel,
.tab-panel,
.related-grids section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-grid section {
  padding: 16px;
}

.metric-grid strong {
  display: block;
  font-size: 1.5rem;
}

.metric-grid span,
.muted {
  color: var(--muted);
}

.work-panel {
  padding: 16px;
  margin-bottom: 16px;
  min-width: 0;
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2,
.section-title h3 {
  font-size: 1.1rem;
  margin: 0;
}

.section-title span {
  color: var(--muted);
}

.data-grid th {
  color: var(--muted);
  font-weight: 700;
}

.grid-actions {
  white-space: nowrap;
  width: 72px;
}

.icon-action {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  line-height: 1;
}

.tabs-grid {
  display: grid;
  gap: 12px;
}

.tab-panel {
  padding: 14px;
}

.tab-panel h3 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--blue);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  font-size: .86rem;
  color: var(--muted);
}

.form-grid input,
.form-grid select {
  color: var(--ink);
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 4px;
}

.movement-query-form {
  max-width: 920px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.related-grids {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
  max-width: 100%;
}

.related-grids section {
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}

.related-grids .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.related-grids .data-grid {
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.related-grids .data-grid th,
.related-grids .data-grid td {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(760px, 92vw);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(24, 33, 47, .22);
}

.child-dialog::backdrop {
  background: rgba(24, 33, 47, .35);
}

.child-dialog form {
  padding: 16px;
}

.child-dialog > .child-dialog-head {
  padding: 16px 16px 0;
}

.child-dialog > .child-form-grid {
  padding: 0 16px;
}

.child-dialog > .button-row {
  padding: 0 16px 16px;
}

.child-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.child-dialog-head h3 {
  font-size: 1rem;
  margin: 0;
}

.child-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.child-form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: .86rem;
}

.vb6-form {
  background: #f0f0f0;
  border: 2px solid #7f9db9;
  box-shadow: inset 0 0 0 1px #ffffff;
  color: #111;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 13px;
  padding: 18px 26px 10px;
  max-width: 920px;
}

.vb6-form input {
  height: 24px;
  border: 2px inset #e6e6e6;
  background: #fff;
  color: #111;
  padding: 2px 5px;
  min-width: 0;
  width: 100%;
}

.vb6-form span,
.vb6-form legend {
  color: #0000ff;
  font-weight: 700;
}

.vb6-form fieldset {
  border: 2px groove #ddd;
  padding: 8px 10px 10px;
  margin: 0;
}

.vb6-form legend {
  float: none;
  width: auto;
  font-size: 13px;
  padding: 0 4px;
  margin: 0;
}

.vb6-inline {
  display: grid;
  grid-template-columns: auto 48px;
  align-items: center;
  gap: 6px;
}

.empresas-top {
  display: grid;
  grid-template-columns: 190px 300px 210px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.empresas-top .unidade {
  grid-template-columns: auto 62px;
}

.empresas-top .tipo {
  grid-template-columns: auto 130px;
}

.empresas-top .tipo select {
  height: 26px;
  border: 2px inset #e6e6e6;
  background: #fff;
  font-family: "MS Sans Serif", Arial, sans-serif;
  font-size: 16px;
  padding: 0 2px;
}

.empresas-top .filial {
  grid-template-columns: auto 58px;
}

.vb6-lookup {
  width: 24px;
  height: 22px;
  border: 2px outset #e6e6e6;
  background: #e9e9e9;
  color: transparent;
  padding: 0;
}

.empresas-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 10px;
}

.empresas-left {
  display: grid;
  gap: 4px;
}

.vb6-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.vb6-row > span {
  color: #222;
  font-weight: 400;
  text-align: right;
}

.cep-uf {
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: center;
}

.cep-field {
  grid-template-columns: 170px 90px;
}

.uf-field {
  grid-template-columns: 1fr 46px;
}

.contact-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.contact-groups fieldset {
  display: grid;
  gap: 6px;
}

.responsavel {
  margin-top: 4px !important;
  display: grid;
  gap: 5px;
}

.responsavel label {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
}

.responsavel label:first-of-type {
  grid-template-columns: 78px minmax(0, 1fr);
}

.responsavel span {
  text-align: right;
}

.empresas-right {
  display: grid;
  gap: 5px;
  align-content: start;
}

.empresas-right fieldset {
  display: grid;
  gap: 5px;
}

.notas label {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.notas span {
  color: #222;
  font-weight: 400;
  text-align: right;
}

.formula-label {
  color: #009999;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  padding-top: 8px;
}

.vb6-auto-window {
  position: relative;
  background: #f0f0f0;
  border: 2px solid #7f9db9;
  box-shadow: inset 0 0 0 1px #ffffff;
  color: #111;
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 12px;
  overflow: auto;
  max-width: 100%;
}

.vb6-auto-control {
  position: absolute;
  box-sizing: border-box;
}

.vb6-auto-panel {
  border: 1px solid #bcbcbc;
  background: #f0f0f0;
}

.vb6-auto-frame {
  border: 2px groove #ddd;
  background: transparent;
  padding: 8px;
  margin: 0;
}

.vb6-auto-frame legend {
  float: none;
  width: auto;
  color: #0000ff;
  font-size: 12px;
  font-weight: 700;
  margin: 0;
  padding: 0 4px;
}

.vb6-auto-label {
  color: #111;
  display: flex;
  align-items: center;
  white-space: normal;
  overflow: hidden;
}

.vb6-auto-label.vb6-formula-label {
  width: max-content !important;
  max-width: none;
  white-space: nowrap;
  overflow: visible;
  transform: translateX(-50%);
}

.vb6-auto-input,
.vb6-auto-button {
  border: 2px inset #e6e6e6;
  background: #fff;
  color: #111;
  font: inherit;
  padding: 1px 4px;
}

.vb6-auto-button {
  border-style: outset;
  background: #e9e9e9;
  overflow: hidden;
}

.vb6-icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.vb6-icon-button svg {
  width: 15px;
  height: 15px;
  fill: #1f2937;
}

.legacy-lookup-popup {
  position: fixed;
  z-index: 2147483647;
  max-height: 220px;
  overflow: auto;
  border: 2px inset #e6e6e6;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .2);
  font-family: "MS Sans Serif", Tahoma, Arial, sans-serif;
  font-size: 12px;
}

.legacy-lookup-popup button {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
  color: #111;
  padding: 4px 8px;
  text-align: left;
}

.legacy-lookup-popup button:hover,
.legacy-lookup-popup button:focus {
  background: #0a246a;
  color: #fff;
}

.vb6-auto-option {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #111;
  line-height: 1.1;
  overflow: hidden;
  white-space: nowrap;
}

.vb6-auto-check {
  margin: 0;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.vb6-auto-option span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.vb6-auto-grid {
  border: 1px solid #808080;
  background: #fff;
  overflow: auto;
}

.vb6-child-grid-title {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: max-content;
  padding: 3px;
  border-bottom: 1px solid #808080;
  background: #f0f0f0;
  color: #0000ff;
  font-weight: 700;
}

.vb6-auto-grid table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.vb6-auto-grid th,
.vb6-auto-grid td {
  border: 1px solid #c7c7c7;
  padding: 2px 4px;
}

.vb6-formula-items-grid table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  line-height: 14px;
}

.vb6-formula-items-grid th,
.vb6-formula-items-grid td {
  height: 18px;
  padding: 1px 4px;
  white-space: nowrap;
}

.vb6-formula-items-grid tbody tr {
  background: #ffff80;
}

.balance-grid .balance-ok td {
  background: #e6f6ea;
}

.balance-grid .balance-fail td {
  background: #fde8e8;
}

.stock-reduction-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #dc3545;
  background: #fff5f5;
}

.vb6-grid-actions {
  white-space: nowrap;
}

.vb6-grid-actions .icon-action,
.vb6-child-grid-title .icon-action {
  width: 24px;
  height: 22px;
  min-width: 24px;
}

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.activity-list li {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.activity-list span {
  color: var(--muted);
  margin-left: 8px;
}

.report-shell {
  display: grid;
  gap: 12px;
}

.report-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.report-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  border: 1px solid #9ca3af;
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
  padding: 0;
}

.report-tool:hover {
  background: #e5e7eb;
  color: #111827;
}

.report-tool svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.report-page-indicator {
  min-width: 86px;
  padding: 0 8px;
  color: #374151;
  font-size: .9rem;
  text-align: center;
}

.report-toolbar-separator {
  width: 1px;
  height: 26px;
  margin: 0 4px;
  background: #cbd5e1;
}

.report-canvas {
  min-height: 620px;
  overflow: auto;
  padding: 22px;
  background: #d1d5db;
  border: 1px solid var(--line);
}

.report-page {
  width: 920px;
  min-height: 1180px;
  margin: 0 auto;
  padding: 44px 48px;
  background: #fff;
  color: #111;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .22);
  font-family: Arial, Helvetica, sans-serif;
}

.report-page-head,
.report-page-foot,
.report-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.report-page-head {
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
  margin-bottom: 10px;
}

.report-page-head h2 {
  font-size: 1.35rem;
  margin: 0 0 4px;
}

.report-page-head span,
.report-meta,
.report-page-foot {
  color: #4b5563;
  font-size: .82rem;
}

.report-meta {
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid #d1d5db;
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f3f4f6;
  font-weight: 700;
}

.report-page-foot {
  border-top: 1px solid #d1d5db;
  margin-top: 28px;
  padding-top: 8px;
}

.mailing-label-report-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid #9ca3af;
  color: #374151;
  font-size: .82rem;
}

.mailing-label-sheet {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
}

.mailing-label {
  min-height: 125px;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px dashed #9ca3af;
  font-size: .9rem;
  line-height: 1.35;
}

.mailing-label strong,
.mailing-label span {
  display: block;
}

.mailing-label strong {
  margin-bottom: 4px;
  font-size: .95rem;
}

@media print {
  .sidebar,
  .topbar,
  .page-head,
  .report-toolbar {
    display: none !important;
  }

  .main-frame,
  .content-frame,
  .report-canvas {
    display: block;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 0;
    overflow: visible;
  }

  .report-page {
    width: auto;
    min-height: auto;
    box-shadow: none;
    transform: none !important;
    padding: 0;
  }

  .mailing-label-report-head {
    display: none;
  }

  .mailing-label {
    border-color: transparent;
  }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef3f7, #d9e8ef);
}

.login-panel {
  width: min(420px, calc(100vw - 28px));
}

.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(20, 35, 55, .14);
}

.login-card h1 {
  font-size: 1.8rem;
  margin: 12px 0 4px;
}

.login-card label {
  margin-top: 10px;
  margin-bottom: 4px;
}

.login-card small,
.login-card p {
  color: var(--muted);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

body.sidebar-collapsed {
  grid-template-columns: 78px 1fr;
}

body.sidebar-collapsed .sidebar {
  width: 78px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .side-menu span,
body.sidebar-collapsed .side-menu summary,
body.sidebar-collapsed .menu-children,
body.sidebar-collapsed .sidebar-footer {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    width: 300px;
    z-index: 10;
    transform: translateX(-100%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .content-frame {
    padding: 12px;
  }

  body.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
}


