/* TradeFlow v7.14.19 R18 — compact direct-Xero phone preview and source details. */

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

@media (max-width: 640px), (max-height: 500px) and (max-width: 950px) {
  /* This presentation is limited to the direct-Xero preview. The CSV preview,
     other TradeFlow tables and the desktop invoice sheet keep their layouts. */
  .tf717-desktop-preview {
    display: none !important;
  }

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

  .tf718-mobile-preview {
    display: block;
    margin: 12px 0;
    overflow: hidden;
  }

  .tf718-mobile-preview-heading {
    margin: 0 0 8px;
    padding: 9px 10px;
    border-radius: 9px;
    background: #eef6f2;
    color: #294c3d;
    font-size: .82rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  #tf714-preview .tf718-mobile-table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #cbded5;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
  }

  .tf718-col-row {
    width: 6%;
  }

  .tf718-col-description {
    width: 40%;
  }

  .tf718-col-quantity {
    width: 9%;
  }

  .tf718-col-unit {
    width: 14%;
  }

  .tf718-col-account {
    width: 11%;
  }

  .tf718-col-total {
    width: 20%;
  }

  #tf714-preview .tf718-mobile-table th,
  #tf714-preview .tf718-mobile-table td {
    min-width: 0 !important;
    max-width: none !important;
    padding: 6px 3px !important;
    border: 0;
    border-right: 1px solid #dbe7e1;
    border-bottom: 1px solid #dbe7e1;
    color: #17231e;
    font-size: clamp(9.5px, 2.65vw, 12px) !important;
    line-height: 1.25;
    text-align: left;
    vertical-align: top;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  #tf714-preview .tf718-mobile-table th:last-child,
  #tf714-preview .tf718-mobile-table td:last-child {
    border-right: 0;
  }

  #tf714-preview .tf718-mobile-table thead th {
    padding-top: 7px !important;
    padding-bottom: 7px !important;
    background: #e7f1ec;
    color: #4e6158;
    font-size: clamp(9px, 2.5vw, 11px) !important;
    font-weight: 850;
    letter-spacing: .025em;
    text-transform: uppercase;
  }

  #tf714-preview .tf718-mobile-table tbody > .tf718-line > th {
    background: #f4f8f6;
    font-weight: 900;
    text-align: center;
  }

  #tf714-preview .tf718-mobile-table .tf718-number {
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  #tf714-preview .tf718-mobile-table .tf718-description {
    font-weight: 750;
  }

  .tf718-description small {
    display: block;
    margin-top: 3px;
    color: #66766e;
    font-size: .9em;
    font-weight: 650;
    line-height: 1.2;
  }

  #tf714-preview .tf718-mobile-table .tf718-description-only > * {
    background: #fafcfb;
    color: #56665e;
  }

  #tf714-preview .tf718-mobile-table .tf718-source-row > td {
    padding: 0 !important;
    border-right: 0;
    background: #f8fbf9;
  }

  .tf718-source-details {
    width: 100%;
    min-width: 0;
  }

  .tf718-source-details > summary {
    padding: 8px 9px;
    color: #205841;
    font-size: clamp(10px, 2.8vw, 12px);
    font-weight: 850;
    line-height: 1.3;
    cursor: pointer;
    overflow-wrap: anywhere;
  }

  .tf718-source-details[open] > summary {
    border-bottom: 1px solid #dbe7e1;
    background: #eef6f2;
  }

  .tf718-source-items {
    display: grid;
    gap: 7px;
    padding: 7px;
  }

  .tf718-source-item {
    min-width: 0;
    margin: 0;
    padding: 7px;
    border: 1px solid #d7e4de;
    border-left: 3px solid #2f765b;
    border-radius: 7px;
    background: #fff;
  }

  .tf718-source-material {
    border-left-color: #7b6740;
  }

  .tf718-source-item h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 6px;
    color: #24372e;
    font-size: clamp(10px, 2.8vw, 12px);
  }

  .tf718-source-item h4 b {
    padding: 2px 5px;
    border-radius: 999px;
    background: #eaf4ef;
    color: #245640;
    font-size: .9em;
  }

  .tf718-source-material h4 b {
    background: #f4f0e7;
    color: #6a562e;
  }

  .tf718-source-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
  }

  .tf718-source-values > div {
    min-width: 0;
  }

  .tf718-source-values .tf718-source-work {
    grid-column: span 2;
  }

  .tf718-source-values dt {
    margin: 0 0 1px;
    color: #6a7971;
    font-size: clamp(8.5px, 2.3vw, 10px);
    font-weight: 800;
    line-height: 1.2;
  }

  .tf718-source-values dd {
    margin: 0;
    color: #1d2c25;
    font-size: clamp(9.5px, 2.6vw, 11.5px);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .tf718-source-subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 9px;
    border-top: 1px solid #dbe7e1;
    color: #294c3d;
    font-size: clamp(10px, 2.8vw, 12px);
  }

  #tf714-preview .tf718-mobile-table tfoot th {
    border-bottom: 0;
    background: #eaf6f0;
    color: #17382b;
    font-weight: 900;
  }

  #tf714-preview .tf718-mobile-table tfoot th:first-child {
    text-align: right;
  }

  #tf714-preview .tf718-mobile-table tfoot th:last-child {
    font-variant-numeric: tabular-nums;
    text-align: right;
  }
}

@media (max-width: 360px) {
  #tf714-preview .tf718-mobile-table th,
  #tf714-preview .tf718-mobile-table td {
    padding-right: 2px !important;
    padding-left: 2px !important;
  }

  .tf718-source-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tf718-source-values .tf718-source-work {
    grid-column: 1 / -1;
  }
}
