/* v0.8.5 PATCH 2 - CLEAN BASE ONLY.
   Preserve the clean-base Historical Orders styling. Only the Settlement toggle is repositioned on wide PC. */
.v085-positive-decline-desktop-break { display: none; }

@media (min-width: 1500px) {
  html body#dpxRoot.desktop-tab-layout.desktop-tab-setup .m8-settlement-card {
    position: relative !important;
  }

  /* Move only this control into the unused upper-right area beside the settlement-mode radios.
     Absolute positioning removes its old row from normal flow, so the lower middle-column fields move up naturally. */
  html body#dpxRoot.desktop-tab-layout.desktop-tab-setup .m8-settlement-card > .v085-positive-decline-toggle {
    position: absolute !important;
    top: 172px !important;
    right: 10px !important;
    width: 255px !important;
    max-width: 255px !important;
    margin: 0 !important;
    z-index: 2 !important;
    grid-template-columns: minmax(0, 1fr) 30px !important;
    gap: 8px !important;
  }

  html body#dpxRoot.desktop-tab-layout.desktop-tab-setup .v085-positive-decline-desktop-break {
    display: block;
  }
}

/* v0.8.5 same-name Historical Orders spacing correction.
   Width-only rules: preserve existing colors/fonts/theme while removing the unused
   width inherited from the former prediction-horizon columns. */
@media (min-width: 901px) and (min-height: 601px) {
  html body#dpxRoot.desktop-tab-layout.user-admin #ledgerTable,
  html body#dpxRoot.desktop-tab-layout.admin-unlocked #ledgerTable {
    border-spacing: 0 !important;
  }

  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Settle1m {
    width: 150px !important; min-width: 150px !important; max-width: 150px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Peak {
    width: 110px !important; min-width: 110px !important; max-width: 110px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Decline {
    width: 90px !important; min-width: 90px !important; max-width: 90px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Threshold {
    width: 155px !important; min-width: 155px !important; max-width: 155px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Snapshot {
    width: 190px !important; min-width: 190px !important; max-width: 190px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085AdjustCount {
    width: 105px !important; min-width: 105px !important; max-width: 105px !important;
    text-align: center !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Action {
    width: 210px !important; min-width: 210px !important; max-width: 210px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Action {
    white-space: normal !important;
    overflow: visible !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Action small {
    display: block !important;
    white-space: nowrap !important;
  }
}

/* Phone portrait administrator Historical Orders uses the same v0.8.5 monitoring
   columns as PC. Horizontal scrolling remains available; only column widths are set. */
@media (max-width: 600px) and (orientation: portrait) {
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Settle1m {
    width: 160px !important; min-width: 160px !important; max-width: 160px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Peak {
    width: 120px !important; min-width: 120px !important; max-width: 120px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Decline {
    width: 105px !important; min-width: 105px !important; max-width: 105px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Threshold {
    width: 160px !important; min-width: 160px !important; max-width: 160px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Snapshot {
    width: 180px !important; min-width: 180px !important; max-width: 180px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085AdjustCount {
    width: 110px !important; min-width: 110px !important; max-width: 110px !important;
    text-align: center !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Action {
    width: 210px !important; min-width: 210px !important; max-width: 210px !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable td.ledger-col-v085Action {
    white-space: normal !important;
    overflow: visible !important;
  }
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable td.ledger-col-v085Action small {
    display: block !important;
    white-space: nowrap !important;
  }
}

/* v0.8.5 SAME-NAME FINAL HISTORICAL ORDERS THREE-GAP SPACING.
   PC only: create real space at exactly three requested boundaries by adding
   width together with left padding. The ledger may extend to the right and
   remain horizontally scrollable; no neighboring header is compressed. */
@media (min-width: 901px) and (min-height: 601px) {
  /* Allow the monitoring area to grow to the right instead of squeezing columns. */
  html body#dpxRoot.desktop-tab-layout.user-admin #ledgerTable,
  html body#dpxRoot.desktop-tab-layout.admin-unlocked #ledgerTable {
    min-width: 1900px !important;
  }

  /* Preserve the small font increase already approved for the new monitoring columns. */
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Settle1m,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Peak,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Decline,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Threshold,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Snapshot,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085AdjustCount,
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v085Action {
    font-size: 13px !important;
  }

  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Settle1m,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Peak,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Decline,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Threshold,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Snapshot,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085AdjustCount,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v085Action {
    font-size: 13.5px !important;
  }

  /* Space #1: Threshold / Breach -> Snapshot. Add width so padding is not stolen from text. */
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Snapshot {
    width: 208px !important; min-width: 208px !important; max-width: 208px !important;
    padding-left: 14px !important;
  }

  /* Space #2: Snapshot -> Adjust Count. */
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085AdjustCount {
    width: 120px !important; min-width: 120px !important; max-width: 120px !important;
    padding-left: 14px !important;
    text-align: center !important;
  }

  /* Space #3: Adjust Count -> Action / Active SL. */
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Action {
    width: 228px !important; min-width: 228px !important; max-width: 228px !important;
    padding-left: 14px !important;
  }
}

/* v0.8.5 SAME-NAME FIVE-POINT VISIBILITY PATCH.
   Only widen the two columns whose content is longer after the approved display changes.
   Do not squeeze neighboring columns; allow Historical Orders to extend right and scroll. */
@media (min-width: 901px) and (min-height: 601px) {
  html body#dpxRoot.desktop-tab-layout.user-admin #ledgerTable,
  html body#dpxRoot.desktop-tab-layout.admin-unlocked #ledgerTable {
    min-width: 2140px !important;
  }

  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Settle1m {
    width: 260px !important; min-width: 260px !important; max-width: 260px !important;
    white-space: nowrap !important;
  }

  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v085Threshold {
    width: 275px !important; min-width: 275px !important; max-width: 275px !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Settle1m {
    width: 250px !important; min-width: 250px !important; max-width: 250px !important;
    white-space: nowrap !important;
  }

  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v085Threshold {
    width: 270px !important; min-width: 270px !important; max-width: 270px !important;
    white-space: nowrap !important;
  }
}


/* v0.8.7 M8 GIVEBACK MONITORING ONLY.
   New diagnostic column is allowed to extend Historical Orders to the right; no existing column is squeezed. */
.v086-giveback-monitor {
  display: grid;
  gap: 2px;
  line-height: 1.2;
  white-space: normal;
}
.v086-giveback-monitor > span { display: block; white-space: nowrap; }

@media (min-width: 901px) and (min-height: 601px) {
  html body#dpxRoot.desktop-tab-layout.user-admin #ledgerTable,
  html body#dpxRoot.desktop-tab-layout.admin-unlocked #ledgerTable {
    min-width: 2520px !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable .ledger-col-v086GivebackMonitor {
    width: 380px !important; min-width: 380px !important; max-width: 380px !important;
    padding-left: 14px !important;
    white-space: normal !important;
  }
  html body#dpxRoot.desktop-tab-layout #ledgerTable th.ledger-col-v086GivebackMonitor,
  html body#dpxRoot.desktop-tab-layout #ledgerTable td.ledger-col-v086GivebackMonitor {
    font-size: 13px !important;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  html body#dpxRoot.phone-tab-layout.user-admin #ledgerTable .ledger-col-v086GivebackMonitor {
    width: 360px !important; min-width: 360px !important; max-width: 360px !important;
    white-space: normal !important;
  }
}
