/* ASNET tables — invoices, transactions, services, tickets. Desktop keeps a
 * real <table>; below 768px each row becomes a labelled card stack instead
 * of introducing horizontal scroll, using the `data-label` attribute on
 * each <td> (progressive enhancement - if a template forgets data-label the
 * cell simply loses its inline label on mobile, nothing breaks). */

.asnet-table-wrap { overflow-x: auto; }

.asnet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--asnet-fs-sm);
}
.asnet-table th {
  text-align: left;
  padding: var(--asnet-space-xs) var(--asnet-space-sm);
  color: var(--asnet-text-muted);
  font-weight: 600;
  font-size: var(--asnet-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--asnet-border);
}
.asnet-table td {
  padding: var(--asnet-space-sm);
  border-bottom: 1px solid var(--asnet-border);
  vertical-align: middle;
  color: var(--asnet-text);
}
.asnet-table tbody tr:last-child td { border-bottom: none; }
.asnet-table tbody tr:hover { background: var(--asnet-surface-muted); }
.asnet-table td.asnet-table-empty { text-align: center; color: var(--asnet-text-muted); padding: var(--asnet-space-lg); }
.asnet-table .asnet-table__num { text-align: right; font-variant-numeric: tabular-nums; }
.asnet-table a.asnet-table__row-link { color: var(--asnet-text); font-weight: 600; }
.asnet-table a.asnet-table__row-link:hover { color: var(--asnet-primary); }

@media (max-width: 767.98px) {
  .asnet-table thead { display: none; }
  .asnet-table, .asnet-table tbody, .asnet-table tr, .asnet-table td { display: block; width: 100%; }
  .asnet-table tr {
    border: 1px solid var(--asnet-border);
    border-radius: var(--asnet-radius-md);
    margin-bottom: var(--asnet-space-sm);
    padding: var(--asnet-space-xs) var(--asnet-space-sm);
    background: var(--asnet-surface-elevated);
  }
  .asnet-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--asnet-space-sm);
    border-bottom: 1px dashed var(--asnet-border);
    padding: var(--asnet-space-xs) 0;
    text-align: right;
  }
  .asnet-table td:last-child { border-bottom: none; }
  .asnet-table td[data-label]::before {
    content: attr(data-label);
    font-size: var(--asnet-fs-xs);
    font-weight: 600;
    color: var(--asnet-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
  }
  .asnet-table td.asnet-table-empty { padding: var(--asnet-space-lg); text-align: center; }
  .asnet-table td.asnet-table-empty::before { content: none; }
}

/* Print the authoritative invoice already shown on screen. These rules remove
 * application/payment chrome and undo the mobile card-table transformation;
 * normal screen and mobile rendering are unchanged. */
@page asnet-invoice-document {
  size: A4;
  margin: 12mm;
}

@media print {
  html,
  body.asnet-app {
    display: block;
    min-height: auto;
    background: #fff !important;
    color: #111 !important;
  }

  body.asnet-page-invoice {
    page: asnet-invoice-document;
  }

  .asnet-page-invoice .asnet-header,
  .asnet-page-invoice .asnet-mobile-nav,
  .asnet-page-invoice .asnet-breadcrumb,
  .asnet-page-invoice .asnet-footer,
  .asnet-page-invoice .asnet-invoice-actions,
  .asnet-page-invoice .asnet-invoice-payment,
  .asnet-page-invoice .asnet-modal,
  .asnet-page-invoice .asnet-alert,
  .asnet-page-invoice .asnet-toast-container {
    display: none !important;
  }

  .asnet-page-invoice .asnet-main {
    display: block;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .asnet-page-invoice .asnet-page-header {
    margin: 0 0 8mm;
  }

  .asnet-page-invoice .asnet-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff !important;
    color: #111 !important;
    padding: 0;
  }

  .asnet-page-invoice .asnet-table-wrap {
    overflow: visible;
  }

  .asnet-page-invoice .asnet-table {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .asnet-page-invoice .asnet-table thead {
    display: table-header-group;
  }

  .asnet-page-invoice .asnet-table tbody {
    display: table-row-group;
  }

  .asnet-page-invoice .asnet-table tr {
    display: table-row;
    break-inside: avoid;
    page-break-inside: avoid;
    border: 0;
    background: transparent !important;
  }

  .asnet-page-invoice .asnet-table th,
  .asnet-page-invoice .asnet-table td {
    display: table-cell;
    width: auto;
    padding: 4px 6px;
    border-color: #bbb;
    color: #111 !important;
    text-align: left;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .asnet-page-invoice .asnet-table td::before {
    content: none !important;
  }

  .asnet-page-invoice .asnet-table .asnet-table__num {
    text-align: right;
  }

  .asnet-page-invoice a {
    color: inherit !important;
    text-decoration: none !important;
  }

  .asnet-page-invoice .asnet-invoice-totals,
  .asnet-page-invoice .asnet-price-box__row {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
