/* TRDecoder V148 - production mobile layout
   Mobile presentation only. Backend/matcher/apply/checksum/credits untouched. */

@media (max-width: 820px) {
  :root {
    --trd-v148-safe-bottom: env(safe-area-inset-bottom, 0px);
    --trd-v148-safe-top: env(safe-area-inset-top, 0px);
  }

  html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body,
  body.trd-dashboard-active,
  body.trd-dashboard-active #trdDash,
  body.trd-dashboard-active .trdDashMain,
  body.trd-dashboard-active .trdMainStack,
  body.trd-dashboard-active .trdPanel,
  body.trd-dashboard-active #binSelectCard,
  body.trd-dashboard-active #opsCard,
  body.trd-dashboard-active #trdPendingSlot,
  body.trd-dashboard-active #trdSearchSlot,
  body.trd-dashboard-active #trdSolutionsSlot {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.trd-dashboard-active {
    overflow-x: hidden !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdDashMain {
    grid-column: 1 !important;
    margin: 0 !important;
    padding: 8px 8px calc(82px + var(--trd-v148-safe-bottom)) !important;
    overflow: visible !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdMainStack {
    gap: 8px !important;
    margin: 0 !important;
  }

  /* 4 desktop workflow cards become a readable 2x2 phone grid. */
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdWorkflow {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: auto !important;
    gap: 7px !important;
    padding: 8px !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 62px !important;
    height: auto !important;
    flex: none !important;
    padding: 9px 7px 9px 43px !important;
    border-radius: 10px !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStepNum {
    left: 9px !important;
    width: 27px !important;
    height: 27px !important;
    font-size: 12px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep b {
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep small {
    font-size: 9px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  /* Result-focus summary: no filename or title may push outside the viewport. */
  body.trd-results-focus #trdResultFocusBar,
  #trdResultFocusBar {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 8px !important;
    padding: 10px !important;
    gap: 9px !important;
    border-radius: 11px !important;
    align-items: stretch !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .trdResultFocusMain {
    width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    align-items: start !important;
  }

  .trdResultFocusStatus {
    width: max-content !important;
    max-width: 100% !important;
    padding: 7px 10px !important;
    font-size: 10px !important;
  }

  .trdResultFocusInfo,
  .trdResultFocusTitle,
  .trdResultFocusMeta {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .trdResultFocusTitle {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  .trdResultFocusMeta {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    font-size: 10px !important;
    line-height: 1.35 !important;
  }

  #trdNewAnalysisBtn {
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
  }

  /* The small result note (e.g. Bulunamadı) stays compact on a phone. */
  body.trd-results-focus #binSelectCard #results,
  body.trd-dashboard-active #results.resultBox,
  #results.resultBox {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 12px !important;
    border-radius: 11px !important;
    overflow: visible !important;
  }

  #results > .muted:only-child,
  #results > .hint:only-child {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.35 !important;
  }

  /* Solution area: one full-width card per row, with natural content height. */
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .opsTable.solutionCardWrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
    border-radius: 11px !important;
    overflow: visible !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionGridToolbar {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    margin: 0 0 8px !important;
    padding: 0 0 8px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionGridToolbar > div:first-child {
    min-width: 0 !important;
    flex: 1 1 180px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionGridToolbar b {
    font-size: 15px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionGridToolbar span {
    display: block !important;
    font-size: 9.5px !important;
    line-height: 1.25 !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .premiumSolutionGrid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionCard,
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18.trd-admin-verified .solutionCard.hasAdminPath {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 96px !important;
    height: auto !important;
    max-height: none !important;
    padding: 12px 48px 12px 12px !important;
    gap: 8px !important;
    overflow: visible !important;
    align-self: stretch !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionCard .solMain,
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18.trd-admin-verified .solutionCard.hasAdminPath .solMain {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solTitle,
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solSub {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solMiniRow {
    display: flex !important;
    flex-wrap: wrap !important;
    max-width: 100% !important;
  }

  .dq200SettingsBtn,
  .trdStructuralBtn {
    max-width: 100% !important;
    min-height: 36px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }

  /* Selected summary must stay in normal flow; no floating dark block over cards. */
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .selSummary,
  body.trd-dashboard-active .selSummary,
  .selSummary {
    position: static !important;
    bottom: auto !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 9px 10px !important;
    padding: 10px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #f8fafc !important;
    border: 1px solid #dce4eb !important;
    color: #334155 !important;
  }

  .selSummaryLeft,
  .selSummaryRight {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    flex-wrap: wrap !important;
  }

  .selSummary .mini {
    font-size: 10px !important;
    color: #64748b !important;
  }

  .selSummary .mini b {
    color: #334155 !important;
  }

  .selChips {
    max-width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
  }

  .selChips .chip {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Native Apply is duplicated by the fixed mobile dock. Keep only request when needed. */
  body.trd-dashboard-active #opsCard > div:last-child {
    display: block !important;
    padding: 0 10px 10px !important;
    border-top: 0 !important;
  }

  body.trd-dashboard-active #opsCard > div:last-child #applyBtn {
    display: none !important;
  }

  body.trd-dashboard-active #opsCard > div:last-child #requestBtn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    height: auto !important;
    margin: 0 !important;
  }

  body.trd-dashboard-active #opsCard > div:last-child #requestBtn:disabled {
    display: none !important;
  }

  /* Phone dock: exactly three useful actions, no horizontal scrolling/clipping. */
  html[data-trd-theme] body.trdPro18.trd-dashboard-active.trd-logged-in .trdBottomDock,
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdBottomDock,
  body.trd-dashboard-active .trdBottomDock {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: calc(66px + var(--trd-v148-safe-bottom)) !important;
    padding: 6px 7px calc(6px + var(--trd-v148-safe-bottom)) !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr 1.16fr !important;
    gap: 6px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    background: rgba(255,255,255,.98) !important;
    border-top: 1px solid #d9e1e8 !important;
    box-shadow: 0 -5px 18px rgba(24,34,48,.08) !important;
  }

  .trdBottomDock .trdSafety,
  .trdBottomDock #trdSafeApplyDock {
    display: none !important;
  }

  html[data-trd-theme] body.trdPro18.trd-dashboard-active.trd-logged-in .trdBottomDock .trdDockBtn,
  body.trd-dashboard-active .trdBottomDock .trdDockBtn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 54px !important;
    height: 54px !important;
    padding: 5px 4px !important;
    margin: 0 !important;
    gap: 3px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    overflow: hidden !important;
  }

  html[data-trd-theme] body.trdPro18.trd-dashboard-active.trd-logged-in .trdBottomDock .trdDockIcon,
  body.trd-dashboard-active .trdBottomDock .trdDockIcon {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    border-radius: 8px !important;
  }

  .trdBottomDock .trdDockIcon .trdSvg {
    width: 17px !important;
    height: 17px !important;
  }

  .trdBottomDock .trdDockCopy {
    width: 100% !important;
    min-width: 0 !important;
    text-align: center !important;
    line-height: 1 !important;
  }

  html[data-trd-theme] body.trdPro18.trd-dashboard-active.trd-logged-in .trdBottomDock .trdDockCopy b,
  body.trd-dashboard-active .trdBottomDock .trdDockCopy b {
    display: block !important;
    width: 100% !important;
    font-size: 9.5px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .trdBottomDock .trdDockCopy small {
    display: none !important;
  }

  /* Floating support button stays above the mobile dock. */
  body .waFloat,
  body.trd-dashboard-active .waFloat {
    right: 10px !important;
    bottom: calc(76px + var(--trd-v148-safe-bottom)) !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    z-index: 79 !important;
  }

  /* Modal/forms also stay inside iPhone/Android viewports. */
  .modal,
  #dq200TuneModal.show,
  #adminModal.show {
    max-width: 100vw !important;
  }

  #dq200TuneModal .dq200ModalCard,
  #adminModal .modalCard,
  .overlayCard {
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 24px - var(--trd-v148-safe-top) - var(--trd-v148-safe-bottom)) !important;
  }
}

@media (max-width: 420px) {
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdDashMain {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdWorkflow {
    gap: 6px !important;
    padding: 6px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep {
    min-height: 58px !important;
    padding-left: 39px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStepNum {
    left: 7px !important;
    width: 25px !important;
    height: 25px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep b {
    font-size: 10px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdStep small {
    font-size: 8.5px !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .solutionCard,
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18.trd-admin-verified .solutionCard.hasAdminPath {
    padding-left: 10px !important;
    padding-right: 45px !important;
  }

  .trdBottomDock .trdDockCopy b {
    font-size: 9px !important;
  }

  #trdApplyDock .trdDockCopy b {
    font-size: 8.5px !important;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .trdWorkflow {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  html body.trd-dashboard-active.trd-professional-v15.trdPro17.trdPro18 .premiumSolutionGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
