/* Dashboard: leitura mais confortável e atalhos com aparência de ação. */
.hero + .stat-grid {
  gap: 14px;
}

.hero + .stat-grid .stat {
  position: relative;
  min-height: 126px;
  overflow: hidden;
  padding: 20px 21px 17px;
  border-color: #dce3ed;
  background: linear-gradient(145deg, #fff 30%, #f6f8fb 100%);
  box-shadow: 0 7px 20px rgba(8, 38, 95, .055);
}

.hero + .stat-grid .stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #386fc4;
}

.hero + .stat-grid .stat::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -42px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: rgba(56, 111, 196, .07);
}

.hero + .stat-grid .stat:nth-child(2)::before { background: #e0a800; }
.hero + .stat-grid .stat:nth-child(2)::after { background: rgba(254, 192, 5, .11); }
.hero + .stat-grid .stat:nth-child(3)::before { background: #16835c; }
.hero + .stat-grid .stat:nth-child(3)::after { background: rgba(22, 131, 92, .08); }
.hero + .stat-grid .stat:nth-child(4)::before { background: #8250b5; }
.hero + .stat-grid .stat:nth-child(4)::after { background: rgba(130, 80, 181, .08); }

.hero + .stat-grid .stat > * { position: relative; z-index: 1; }
.hero + .stat-grid .stat span { color: #53637c; font-size: 12px; font-weight: 750; }
.hero + .stat-grid .stat strong { margin: 8px 0 2px; color: var(--navy); font-size: 27px; letter-spacing: -.02em; }
.hero + .stat-grid .stat small { color: #6a7890; font-size: 11px; }

.quick-grid {
  gap: 14px;
}

.quick-grid .quick {
  position: relative;
  min-height: 70px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 11px;
  padding: 11px 14px;
  border: 1px solid #d9e1ec;
  border-left: 4px solid var(--yellow);
  background: linear-gradient(140deg, #fff 30%, #fff9e8 100%);
  box-shadow: 0 6px 17px rgba(8, 38, 95, .045);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.quick-grid .quick::after {
  content: "→";
  position: static;
  grid-column: 3;
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  transform: none;
  transition: background .16s ease, transform .16s ease;
}

.quick-grid .quick:nth-child(2) { background: linear-gradient(140deg, #fff 30%, #f3f7fc 100%); }
.quick-grid .quick:nth-child(3) { background: linear-gradient(140deg, #fff 30%, #f1faf6 100%); }
.quick-grid .quick:nth-child(4) { background: linear-gradient(140deg, #fff 30%, #f7f3fb 100%); }
.quick-grid .quick:nth-child(2) { border-left-color: #386fc4; }
.quick-grid .quick:nth-child(3) { border-left-color: #16835c; }
.quick-grid .quick:nth-child(4) { border-left-color: #8250b5; }

.quick-grid .quick b {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  margin: 0 0 2px;
  color: var(--navy);
  font-size: 15px;
  line-height: 1.2;
}

.quick-grid .quick span {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  color: #65748c;
  font-size: 11px;
}

.quick-grid .quick .quick-action-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff1bd;
  color: var(--navy);
}

.quick-grid .quick:nth-child(2) .quick-action-icon { background: #e9f1fc; color: #2863b6; }
.quick-grid .quick:nth-child(3) .quick-action-icon { background: #e5f6ee; color: #11744f; }
.quick-grid .quick:nth-child(4) .quick-action-icon { background: #f0e9f8; color: #70409f; }
.quick-action-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.quick-grid .quick:hover {
  border-color: #d6b33d;
  box-shadow: 0 10px 24px rgba(8, 38, 95, .1);
  transform: translateY(-2px);
}

.quick-grid .quick:hover::after {
  background: #123a79;
  transform: translateX(2px);
}

.quick-grid .quick:focus-visible {
  outline: 3px solid rgba(254, 192, 5, .3);
  outline-offset: 2px;
}

@media (max-width: 1050px) {
  .hero + .stat-grid .stat { min-height: 116px; padding: 17px 18px 15px; }
  .quick-grid .quick { min-height: 68px; }
}

/* Ações das vendas recentes: botões reconhecíveis sem pesar na tabela. */
.sales-management-table .table-actions {
  align-items: center;
  gap: 7px;
}

.sales-management-table .table-actions .icon-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid #cfd9e7;
  background: #eef4fc;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 3px 9px rgba(8, 38, 95, .06);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.sales-management-table .table-actions [data-sale-details]::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Zm9.5 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sales-management-table .table-actions [data-sale-print] {
  border-color: #e1b72a;
  background: #fff3c6;
}

.sales-management-table .table-actions [data-sale-print]::before {
  content: "";
  width: 14px;
  height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' d='M7 9V3h10v6M7 17H4V9h16v8h-3m-10-4h10v8H7v-8Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sales-management-table .table-actions .icon-btn:hover {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 14px rgba(8, 38, 95, .16);
  transform: translateY(-1px);
}

.sales-management-table .table-actions .icon-btn:focus-visible {
  outline: 3px solid rgba(254, 192, 5, .32);
  outline-offset: 2px;
}

/* Dashboard responsivo: vendas recentes e estoque baixo empilham sem alargar a página. */
.quick-grid + .grid-2,
.quick-grid + .grid-2 > .card {
  min-width: 0;
  max-width: 100%;
}

.quick-grid + .grid-2 .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

/* A tabela da Dashboard distribui sempre as colunas dentro do próprio card. */
.quick-grid + .grid-2 .sales-management-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.quick-grid + .grid-2 .sales-management-table th,
.quick-grid + .grid-2 .sales-management-table td {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-grid + .grid-2 .sales-management-table th:first-child,
.quick-grid + .grid-2 .sales-management-table td:first-child { width: 18%; }
.quick-grid + .grid-2 .sales-management-table th:nth-child(2),
.quick-grid + .grid-2 .sales-management-table td:nth-child(2) { width: 11%; }
.quick-grid + .grid-2 .sales-management-table th:nth-child(3),
.quick-grid + .grid-2 .sales-management-table td:nth-child(3) { width: 13%; }
.quick-grid + .grid-2 .sales-management-table th:nth-child(4),
.quick-grid + .grid-2 .sales-management-table td:nth-child(4) { width: 11%; }
.quick-grid + .grid-2 .sales-management-table th:nth-child(5),
.quick-grid + .grid-2 .sales-management-table td:nth-child(5) { width: 10%; }
.quick-grid + .grid-2 .sales-management-table th:nth-child(6),
.quick-grid + .grid-2 .sales-management-table td:nth-child(6) { width: 10%; }
.quick-grid + .grid-2 .sales-management-table th:last-child,
.quick-grid + .grid-2 .sales-management-table td:last-child { width: 27%; }

/* A grade principal precisa empilhar antes de a tabela perder espaço útil.
   O breakpoint considera também os 246 px ocupados pela navegação lateral. */
@media (max-width: 1540px) {
  .quick-grid + .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-grid + .grid-2 > .card {
    width: 100%;
    overflow: hidden;
  }

  .quick-grid + .grid-2 .sales-management-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .quick-grid + .grid-2 .sales-management-table th,
  .quick-grid + .grid-2 .sales-management-table td {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quick-grid + .grid-2 .sales-management-table th:first-child,
  .quick-grid + .grid-2 .sales-management-table td:first-child { width: 20%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(2),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(2) { width: 12%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(3),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(3) { width: 15%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(4),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(4) { width: 12%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(5),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(5) { width: 15%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(6),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(6) { display: none; }
  .quick-grid + .grid-2 .sales-management-table th:last-child,
  .quick-grid + .grid-2 .sales-management-table td:last-child { width: 26%; }
}

@media (max-width: 760px) {
  .quick-grid + .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-grid + .grid-2 > .card {
    overflow: hidden;
  }

  .quick-grid + .grid-2 .sales-management-table th:nth-child(4),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(4),
  .quick-grid + .grid-2 .sales-management-table th:nth-child(6),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(6) {
    display: none;
  }

  .quick-grid + .grid-2 .sales-management-table th:first-child,
  .quick-grid + .grid-2 .sales-management-table td:first-child { width: 28%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(2),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(2) { width: 19%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(3),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(3) { width: 21%; }
  .quick-grid + .grid-2 .sales-management-table th:nth-child(5),
  .quick-grid + .grid-2 .sales-management-table td:nth-child(5) { width: 18%; }
  .quick-grid + .grid-2 .sales-management-table th:last-child,
  .quick-grid + .grid-2 .sales-management-table td:last-child { width: 14%; }

  .quick-grid + .grid-2 .sales-management-table .table-actions .icon-btn {
    padding-inline: 8px;
    font-size: 0;
  }
}

/* Estrutura final da Dashboard: blocos completos, sem compressão entre si. */
.quick-grid + .grid-2 {
  grid-template-columns: minmax(0, 1fr) !important;
}

.quick-grid + .grid-2 > .card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.quick-grid + .grid-2 .sales-management-table {
  width: 100%;
  min-width: 760px;
  table-layout: auto;
}

.quick-grid + .grid-2 .sales-management-table th,
.quick-grid + .grid-2 .sales-management-table td {
  width: auto !important;
  display: table-cell !important;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.quick-grid + .grid-2 .sales-management-table th:last-child,
.quick-grid + .grid-2 .sales-management-table td:last-child {
  min-width: 190px;
}

.dashboard-sales-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid #edf0f5;
}

.dashboard-sales-pagination span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-sales-pagination .icon-btn {
  color: var(--navy);
  font-weight: 800;
}

.dashboard-sales-pagination .icon-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
