/* The Diamond Reports 3.6.4 - Mobile layout and editor footer repair.
   Presentation-only rules. Report generation, PDF, draft and data handlers
   are unchanged. Keep AFTER apple-interface.css in the document. */

/* A three-column titlebar with hidden spacers used to squeeze Thai "More"
   into a fixed 40px grid track. Make it a real full-width heading. */
html[data-design="apple"] body #iosMoreView .ios-page-titlebar {
  display:flex!important;
  flex-flow:row nowrap!important;
  width:100%!important;
  min-width:0!important;
  align-items:center!important;
  justify-content:flex-start!important;
  margin:0 0 22px!important;
  padding:0!important;
}
html[data-design="apple"] body #iosMoreView .ios-page-titlebar .ios-titlebar-spacer { display:none!important; }
html[data-design="apple"] body #iosMoreView .ios-page-titlebar h1 {
  display:block!important;
  flex:1 1 auto!important;
  min-width:0!important;
  width:auto!important;
  margin:0!important;
  text-align:left!important;
  white-space:nowrap!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  font-size:clamp(27px,7vw,34px)!important;
  line-height:1.3!important;
}

/* Operation/success card: the ring wrapper was 80px but the SVG was 100px.
   These 1:1 dimensions centre the ring around its own checkmark correctly. */
html[data-design="apple"] body .tdr-op-layer .tdr-op-ring-wrap {
  display:grid!important;
  place-items:center!important;
  width:100px!important;
  height:100px!important;
  margin:4px auto 16px!important;
}
html[data-design="apple"] body .tdr-op-layer.is-confirm .tdr-op-ring-wrap { display:none!important; }
html[data-design="apple"] body .tdr-op-layer .tdr-op-ring {
  display:block!important;
  width:100px!important;
  height:100px!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  flex:none!important;
}
html[data-design="apple"] body .tdr-op-layer .tdr-op-icon {
  position:absolute!important;
  top:50%!important;
  left:50%!important;
  width:44px!important;
  height:44px!important;
  display:grid!important;
  place-items:center!important;
  transform:translate(-50%,-50%)!important;
}
html[data-design="apple"] body .tdr-op-layer .tdr-op-icon svg {
  display:block!important;
  width:36px!important;
  height:36px!important;
  flex:none!important;
}

/* A logo selector in the form previously had a hard-coded dark text colour
   and became unreadable in dark mode. */
html[data-design="apple"] body #app .pdf-logo-option,
html[data-design="apple"] body #app .pdf-logo-option-copy { min-width:0!important; }
html[data-design="apple"] body #app .pdf-logo-option-title {
  color:var(--ai-ink)!important;
  line-height:1.35!important;
  font-size:14px!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
}
html[data-design="apple"] body #app .pdf-logo-option-help {
  color:var(--ai-secondary)!important;
  line-height:1.5!important;
}
html[data-design="apple"] body #app .pdf-logo-state { color:var(--ai-secondary)!important; }

/* Only hide the five browsing tabs while editing a report. Their markup and
   event handlers remain in place, and they return on Home/Clients/History. */
body.ios-shell-active.ios-editor-mode #iosTabbar,
html[data-design="apple"] body.ios-editor-mode #iosTabbar {
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
}

/* Put the existing Generate PDF button in the slot occupied by the tab bar.
   Safe-area spacing is included in the footer; never stack both bottom bars. */
html[data-design="apple"] body.ios-editor-mode .mobile-actionbar:not(.ios-hidden) {
  display:block!important;
  position:fixed!important;
  left:0!important;
  right:0!important;
  bottom:0!important;
  top:auto!important;
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:11px max(16px,env(safe-area-inset-right))
          calc(11px + env(safe-area-inset-bottom,0px))
          max(16px,env(safe-area-inset-left))!important;
  box-sizing:border-box!important;
  border:0!important;
  border-top:1px solid var(--ai-line)!important;
  border-radius:0!important;
  background:var(--ai-glass)!important;
  box-shadow:0 -8px 28px rgba(0,0,0,.075)!important;
  -webkit-backdrop-filter:blur(22px) saturate(135%)!important;
  backdrop-filter:blur(22px) saturate(135%)!important;
  z-index:10750!important;
}
html[data-design="apple"] body.ios-editor-mode .mobile-actionbar-inner.tdr-pdf-only-actions {
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  align-items:center!important;
  width:min(100%,860px)!important;
  max-width:860px!important;
  margin:0 auto!important;
  padding:0!important;
  gap:0!important;
}
html[data-design="apple"] body.ios-editor-mode .mobile-actionbar .tdr-pdf-only-actions > .btn-primary {
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
  min-height:54px!important;
  padding:12px 20px!important;
  margin:0!important;
  font-size:17px!important;
  font-weight:670!important;
  line-height:1.25!important;
  border-radius:17px!important;
  box-sizing:border-box!important;
}
/* The report body can scroll behind its fixed footer without the last row
   or the status legend ending underneath the action. */
html[data-design="apple"] body.ios-editor-mode #app.ios-report-page {
  padding-bottom:calc(122px + env(safe-area-inset-bottom,0px))!important;
}
/* Keep the native-style back affordance visible and thumb-sized. */
html[data-design="apple"] body.ios-editor-mode #app .ios-report-back {
  display:grid!important;
  place-items:center!important;
  width:44px!important;
  min-width:44px!important;
  height:44px!important;
  min-height:44px!important;
  color:var(--ai-blue)!important;
  opacity:1!important;
}
html[data-design="apple"] body.ios-editor-mode #app .ios-report-back svg {
  width:24px!important;
  height:24px!important;
}
@media (max-width:375px){
  html[data-design="apple"] body.ios-editor-mode .mobile-actionbar:not(.ios-hidden){
    padding-left:12px!important;
    padding-right:12px!important;
  }
}
@media (prefers-reduced-transparency:reduce){
  html[data-design="apple"] body.ios-editor-mode .mobile-actionbar:not(.ios-hidden){
    background:var(--ai-surface)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
}

/* Do not leave the old in-flow Generate PDF button below the report:
   the fixed footer is now the single primary action across viewport sizes. */
html[data-design="apple"] body.ios-editor-mode #app .desktop-actions.tdr-pdf-only-actions {
  display:none!important;
}
