/* TradeFlow v7.14.19 R17 — Xero reference and one-screen-width phone preview. */

.tf717-mobile-preview {
  display: none;
}

.tf717-invoice-summary {
  overflow-wrap: anywhere;
}

.tf716-contact-results {
  scrollbar-gutter: stable;
}

.tf716-contact-result {
  content-visibility: auto;
  contain-intrinsic-size: 64px;
}

@media (max-width: 640px) {
  /* The direct-Xero preview becomes a compact phone invoice sheet. CSV keeps
     its exact spreadsheet layout because this request applies only here. */
  .tf717-desktop-preview {
    display: none !important;
  }

  .tf717-mobile-preview {
    display: grid;
    min-width: 0;
    gap: 10px;
    margin: 12px 0;
  }

  .tf717-mobile-preview-heading {
    margin: 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: #eef6f2;
    color: #294c3d;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  .tf717-mobile-line {
    min-width: 0;
    padding: 12px;
    border: 1px solid #cbded5;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(23, 35, 30, .06);
    overflow: hidden;
  }

  .tf717-mobile-line > header {
    position: static !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start !important;
    gap: 5px 9px !important;
    margin: 0 0 10px !important;
    padding: 0 0 9px !important;
    border-bottom: 1px solid #e0e9e4 !important;
    background: transparent !important;
  }

  .tf717-mobile-line > header strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .tf717-mobile-line > header .pill {
    grid-column: 2;
    justify-self: start;
  }

  .tf717-line-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eaf4ef;
    color: #26483a;
    font-size: .82rem;
    font-weight: 850;
    white-space: nowrap;
  }

  .tf717-line-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin: 0;
  }

  .tf717-line-fields > div {
    min-width: 0;
    padding: 8px 9px;
    border-radius: 8px;
    background: #f5f8f6;
  }

  .tf717-line-fields dt {
    margin: 0 0 3px;
    color: #607067;
    font-size: .78rem;
    font-weight: 750;
  }

  .tf717-line-fields dd {
    margin: 0;
    color: #17231e;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .tf717-line-fields .tf717-line-total {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    background: #eaf6f0;
  }

  .tf717-line-sources {
    min-width: 0;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #e0e9e4;
    overflow-wrap: anywhere;
  }

  .tf717-line-sources > b {
    display: block;
    margin-bottom: 4px;
    color: #607067;
    font-size: .78rem;
  }

  .tf717-mobile-preview .tf715-source-details {
    min-width: 0;
    max-width: none;
  }

  .tf717-mobile-preview .tf715-source-details summary,
  .tf717-mobile-preview .tf715-source-details li {
    overflow-wrap: anywhere;
  }

  .tf717-description-only {
    border-left: 4px solid #7b8d84;
    background: #fafcfb;
  }

  .tf717-description-only > p {
    margin: 0;
    overflow-wrap: anywhere;
  }

  .tf717-mobile-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 2px solid #126b4f;
    border-radius: 11px;
    background: #eaf6f0;
    color: #17382b;
  }

  .tf717-mobile-total b {
    font-size: 1.12rem;
  }

  #tf714-preview,
  #tf714-preview > *,
  .tf717-mobile-preview,
  .tf717-mobile-line {
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 360px) {
  .tf717-line-fields {
    grid-template-columns: 1fr;
  }

  .tf717-line-fields .tf717-line-total {
    grid-column: 1;
  }
}
