/*
 * Position tables inherit the canonical workspace grid overflow contract.
 *
 * Width, overflow, truncation and action-cell behavior must stay centralized
 * in 16-grid-overflow-guards.css so the administrative position grids behave
 * exactly like every other table.
 */

@media (min-width: 1280px) {
  .workspace-table--positions {
    min-width: 64rem;
  }

  .workspace-table--positions tbody td {
    font-size: 0.8125rem;
    line-height: 1.25;
  }

  .workspace-table--fund-positions th:nth-child(1),
  .workspace-table--fund-positions td:nth-child(1) {
    width: 17%;
  }

  .workspace-table--fund-positions th:nth-child(2),
  .workspace-table--fund-positions td:nth-child(2) {
    width: 20%;
  }

  .workspace-table--fixed-income-positions th:nth-child(1),
  .workspace-table--fixed-income-positions td:nth-child(1) {
    width: 15%;
  }

  .workspace-table--fixed-income-positions th:nth-child(2),
  .workspace-table--fixed-income-positions td:nth-child(2) {
    width: 17%;
  }

  .workspace-table--custody-positions th:nth-child(1),
  .workspace-table--custody-positions td:nth-child(1) {
    width: 9%;
  }

  .workspace-table--custody-positions th:nth-child(2),
  .workspace-table--custody-positions td:nth-child(2) {
    width: 17%;
  }

  .workspace-table--custody-positions th:nth-child(3),
  .workspace-table--custody-positions td:nth-child(3) {
    width: 22%;
  }

  .workspace-table--custody-positions th:nth-child(4),
  .workspace-table--custody-positions td:nth-child(4),
  .workspace-table--custody-positions th:nth-child(5),
  .workspace-table--custody-positions td:nth-child(5),
  .workspace-table--custody-positions th:nth-child(6),
  .workspace-table--custody-positions td:nth-child(6) {
    width: 10%;
  }

  .workspace-table--custody-positions th:nth-child(7),
  .workspace-table--custody-positions td:nth-child(7) {
    width: 10%;
  }

  .workspace-table--custody-positions th:nth-child(8),
  .workspace-table--custody-positions td:nth-child(8) {
    width: 8%;
  }

  /* Coluna de ACOES (Detalhe + Excluir): largura para DOIS botoes, reconciliada com o guard de
     overflow (16-grid-overflow-guards.css, que ja usa calc(2 * --btn-width-sm) via
     positionActionsRow/offerActionsRow). Antes forcava 8.5rem (~1 botao) e, com table-layout:fixed,
     ESTREITAVA a celula sobrepondo o guard e CORTANDO o botao vermelho "Excluir" no >=1280px.
     nowrap garante os dois botoes na MESMA linha (RF e Fundos). */
  .workspace-table--positions th:last-child,
  .workspace-table--positions td:last-child {
    width: calc(2 * var(--btn-width-sm, 120px));
    white-space: nowrap;
  }
}

/* Resumo do cadastro: status e rÃ³tulos nunca ultrapassam a coluna no compacto. */
@media (max-width: 1023px) {
  .order-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-detail-summary-item,
  .order-detail-summary-label,
  .order-detail-summary-value {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .order-detail-summary .workspace-status-badge {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }
}

/* Identificador do movimento pode ser longo; no compacto ele quebra dentro do cabeçalho. */
@media (max-width: 1023px) {
  .extract-movement-detail-header > :first-child {
    min-width: 0;
    flex: 1 1 0;
  }

  .extract-movement-detail-header .extract-movement-identifier {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Produto de renda fixa: nova oferta acima; editar e desativar dividem a linha abaixo. */
@media (max-width: 1023px) {
  .fixed-income-product-detail-header-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start !important;
    gap: 0.75rem !important;
  }

  .fixed-income-product-detail-header-actions > :first-child {
    grid-column: 1;
    grid-row: 1;
    width: auto !important;
  }

  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons {
    display: contents !important;
  }

  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons > :first-child {
    grid-column: 2;
    grid-row: 1;
    width: auto !important;
    min-width: max-content !important;
  }

  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons > :nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }

  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons > :nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons > :nth-child(n + 2),
  .fixed-income-product-detail-header-actions .workspace-panel-header-buttons > form > .btn-canonical {
    width: 100% !important;
    min-width: 0 !important;
  }
}
