/* Responsive refinements for the SoluECF administrative portal.
   Layout only: preserves the canonical colors, type and branding. */
@media screen {
  .portal-content .metrics + .ant-card {
    min-width: 0;
  }

  .portal-content .metrics + .ant-card .ant-card-body,
  .portal-content .metrics + .ant-card .ant-table-wrapper,
  .portal-content .metrics + .ant-card .ant-spin-nested-loading,
  .portal-content .metrics + .ant-card .ant-spin-container,
  .portal-content .metrics + .ant-card .ant-table,
  .portal-content .metrics + .ant-card .ant-table-container {
    min-width: 0;
    max-width: 100%;
  }

  .portal-content .metrics + .ant-card .ant-table-content {
    max-width: 100%;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .portal-content .metrics + .ant-card .ant-table-content > table {
    min-width: 1080px;
  }

  .portal-content .metrics + .ant-card th:first-child,
  .portal-content .metrics + .ant-card td:first-child {
    min-width: 210px;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .portal-content .metrics + .ant-card th:last-child,
  .portal-content .metrics + .ant-card td:last-child {
    min-width: 128px;
    white-space: nowrap;
  }
}

@media screen and (max-width: 1100px) {
  .portal-content .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-header {
    gap: 10px;
  }

  .portal-header .header-end {
    min-width: 0;
  }
}

@media screen and (max-width: 760px) {
  .portal-content {
    padding: 14px 10px;
  }

  .portal-content .metrics {
    gap: 8px;
  }

  .portal-content .metrics .ant-card-body {
    padding: 14px !important;
  }

  .portal-content .metrics + .ant-card .ant-card-head {
    min-height: 48px;
    padding-inline: 14px;
  }

  .portal-content .metrics + .ant-card .ant-card-head-wrapper {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .portal-content .metrics + .ant-card .ant-card-extra {
    flex: 1 0 100%;
    width: 100%;
    margin-inline-start: 0;
  }

  .portal-content .metrics + .ant-card .ant-card-extra .ant-input-affix-wrapper {
    width: 100% !important;
  }

  .portal-content .metrics + .ant-card .ant-card-body {
    padding: 12px !important;
  }

  .portal-content .metrics + .ant-card .ant-table-content {
    overflow: visible !important;
  }

  .portal-content .metrics + .ant-card .ant-table-content > table {
    display: block;
    min-width: 0;
  }

  .portal-content .metrics + .ant-card .ant-table-thead {
    display: none;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody {
    display: grid;
    gap: 10px;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px;
    border: 1px solid var(--ant-color-border-secondary, #e7ebf0);
    border-radius: 10px;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td.ant-table-cell {
    display: flex;
    min-width: 0;
    padding: 7px 8px !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 0 !important;
    white-space: normal;
    text-align: right;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td.ant-table-cell::before {
    flex: 0 0 auto;
    color: var(--ant-color-text-secondary, #667085);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(1) {
    grid-column: 1 / -1;
    min-width: 0;
    font-weight: 600;
    text-align: left;
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(1)::before { content: "Empresa"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(2)::before { content: "RNC"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(3)::before { content: "Ambiente"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(4)::before { content: "Emitidos"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(5)::before { content: "Recibidos"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(6)::before { content: "Estado"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(7)::before { content: "Firma digital"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(8)::before { content: "Última emisión"; }
  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(9)::before { content: "Acciones"; }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-placeholder {
    display: table-row;
  }

  .ant-modal-root .ant-modal {
    width: calc(100vw - 24px) !important;
    max-width: none;
    margin: 12px auto;
    top: 0;
  }

  .ant-modal-root .ant-modal-content {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .ant-modal-root .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .soluecf-token-header {
    align-items: stretch;
    flex-direction: column;
  }

  .soluecf-token-header .ant-btn {
    width: 100%;
  }
}

@media screen and (max-width: 500px) {
  .portal-content .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-content .metrics + .ant-card .ant-table-tbody > tr.ant-table-row > td:nth-child(1) {
    grid-column: auto;
  }
}
