/* DPX v0.7.4 fixed-v4 patch overrides.
   Scope only: iPhone 14 portrait visibility and Flip Diagnostic Log display. */

.flip-diagnostic-heading {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  min-width: 0 !important;
  margin-bottom: 4px !important;
}
.flip-diagnostic-heading > strong { min-width: 0 !important; }
.flip-diagnostic-event {
  display: block !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  line-height: 1.22 !important;
  padding: 0 0 5px !important;
  margin: 0 0 5px !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
}
.flip-diagnostic-event:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: 0 !important;
}

/* PC/laptop and phone landscape: compact log height, with vertical scroll. */
@media (min-width: 601px) {
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    min-height: 88px !important;
    height: 118px !important;
    max-height: 150px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}
@media (min-width: 601px) and (max-width: 1100px) and (orientation: landscape) {
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    min-height: 82px !important;
    height: 104px !important;
    max-height: 132px !important;
  }
}

/* iPhone 14 / phone portrait only. */
@media (max-width: 600px) and (orientation: portrait) {
  /* Entry: keep the complete Min Est. % (Entry only): label visible. */
  body.phone-tab-layout #phoneEntryPanel .horizon-param-grid.six-horizon-grid {
    grid-template-columns: minmax(72px, .95fr) repeat(6, minmax(0, 1fr)) !important;
  }
  body.phone-tab-layout #phoneEntryPanel .entry-min-est-label {
    font-size: 6.5px !important;
    line-height: 1.08 !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: normal !important;
  }
  body.phone-tab-layout #phoneEntryPanel .entry-min-est-label .entry-min-est-base,
  body.phone-tab-layout #phoneEntryPanel .entry-min-est-label .entry-only-note {
    display: block !important;
    white-space: nowrap !important;
  }

  /* Adjust: give numeric Min Est. % values enough room for 10.00. */
  body.phone-tab-layout #phoneAdjustPanel .horizon-param-grid.six-horizon-grid {
    grid-template-columns: minmax(54px, .72fr) repeat(6, minmax(0, 1fr)) !important;
  }
  body.phone-tab-layout #phoneAdjustPanel .horizon-param-grid.six-horizon-grid .horizon-row-label {
    font-size: 7px !important;
  }
  body.phone-tab-layout #phoneAdjustPanel input[id^="autoAdjustEst"] {
    font-size: 8.2px !important;
    letter-spacing: -0.025em !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  /* Settlement: widen Mode so Coinbase Simulation is fully visible. */
  body.phone-tab-layout .phone-auto-panel .v073-tools-card .v073-execution-grid > label.v073-execution-mode,
  body.phone-tab-layout .phone-auto-panel .v073-tools-card .v073-execution-mode {
    grid-template-columns: minmax(0, 1fr) minmax(202px, 210px) !important;
  }
  body.phone-tab-layout #autoPaperExecutionMode {
    min-width: 202px !important;
    max-width: 210px !important;
    font-size: 8.5px !important;
    padding-left: 5px !important;
    padding-right: 26px !important;
  }

  body.phone-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    overflow-x: hidden !important;
  }
}

/* ========================================================================== 
   DPX v0.7.4 Patch List - 2
   Scope only: portrait Min Est. font visibility and wide Flip Log height.
   ========================================================================== */

/* Patch 2: phone portrait only. The actual app uses #dpxRoot; this selector is
   intentionally specific enough to override earlier legacy phone font rules. */
@media (max-width: 600px) and (orientation: portrait) {
  html body#dpxRoot.phone-tab-layout #phoneEntryPanel .horizon-param-grid .text-input[id^="autoEntryEst"],
  html body#dpxRoot.phone-tab-layout #phoneAdjustPanel .horizon-param-grid .text-input[id^="autoAdjustEst"] {
    font-size: 12px !important;
    letter-spacing: -0.02em !important;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
  }
}

/* Patch 3: wide layouts. Increase the visible Flip Diagnostic Log height so the
   right tools frame aligns with the Settlement Conditions frame while keeping
   older diagnostic events reachable through vertical scrolling. */
@media (min-width: 601px) {
  body.desktop-tab-layout .v073-settings-grid {
    align-content: start !important;
    grid-auto-rows: max-content !important;
  }
  body.desktop-tab-layout .v073-settings-grid > .v073-tools-card {
    align-self: start !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body.desktop-tab-layout .v073-tools-card .flip-diagnostic-panel {
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    flex: 0 0 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
}
@media (min-width: 1101px) and (max-width: 1500px) {
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    height: 188px !important;
    min-height: 188px !important;
    max-height: 188px !important;
  }
}
@media (min-width: 1501px) {
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    height: 197px !important;
    min-height: 197px !important;
    max-height: 197px !important;
  }
}
@media (min-width: 601px) and (max-width: 1100px) and (orientation: landscape) {
  body.desktop-tab-layout .v073-tools-card #autoFlipDiagnosticLog {
    height: 236px !important;
    min-height: 236px !important;
    max-height: 236px !important;
  }
}
