/* BR Workspace 8.27.4 · prioridad iPhone
   Capa deliberadamente acotada a <=699px. No modifica iPad ni escritorio. */
@media (max-width:699px){
  :root{
    --br-iphone-gutter:12px;
    --br-iphone-nav-h:74px;
    --br-iphone-radius:17px;
    --br-iphone-touch:46px;
  }

  html{
    width:100%;
    max-width:100%;
    overflow-x:clip!important;
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }
  body{
    width:100%;
    max-width:100%;
    margin:0;
    overflow-x:clip!important;
    padding-bottom:calc(var(--br-iphone-nav-h) + 34px + env(safe-area-inset-bottom,0px))!important;
  }
  .app,.layout,.main,.content,main,.view,.view.active,
  .brw-shell,.brw-home-layout,.brw-home-main,.brw-home-rail,
  .card,.panel,.module-card,.specialized-card,.br8125-card,
  .module-hero,.knowledge-hero,.people-hero,.welcome-new,
  .investigation-layout,.specialized-layout,.people-layout,.knowledge-layout,
  .dashboard-grid,.home-grid,.indicators-grid,.form-grid,
  .diffusion-workspace,.creative-preview-shell,.report-sheet,.document-preview{
    min-width:0!important;
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  /* Ritmo y márgenes propios de iPhone */
  .view{padding:10px var(--br-iphone-gutter) 22px!important}
  .view.active>section,.view.active>article{max-width:100%!important}
  .topbar{padding:9px 11px!important;min-height:54px!important;gap:8px!important}
  .topbar .page-title{min-width:0!important}
  .topbar .page-title h1,.topbar h1{font-size:.94rem!important;line-height:1.15!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

  /* Tipografía móvil: legible sin agrandar en exceso */
  .view h1,.module-hero h1,.welcome-new h1{font-size:1.62rem!important;line-height:1.12!important;letter-spacing:-.025em!important}
  .view h2,.module-hero h2,.knowledge-hero h2,.people-hero h2,.br8125-page-head h2{font-size:1.34rem!important;line-height:1.18!important;letter-spacing:-.018em!important}
  .view h3,.card h3,.panel h3{font-size:1.03rem!important;line-height:1.25!important}
  .view p,.card p,.panel p,.view li{font-size:.86rem;line-height:1.48}
  .eyebrow,.view small,.card small{line-height:1.35}
  label{line-height:1.3}

  /* Tarjetas compactas, sin perder jerarquía */
  .card,.panel,.module-card,.specialized-card,.br8125-card,
  .brw-panel,.brw-priority-card,.brw-calendar,.brw-today,.brw-personal,.brw-notes{
    border-radius:var(--br-iphone-radius)!important;
  }
  .card,.module-card,.specialized-card,.br8125-card{padding:14px!important}
  .brw-panel{padding:15px 13px!important}
  .brw-brief{padding:17px 15px!important;border-radius:19px!important}
  .brw-priority-grid,.brw-continue-grid,.brw-work-grid{gap:10px!important}
  .brw-priority-card{min-height:118px!important;padding:13px!important}
  .brw-continue-grid>button{min-height:78px!important;padding:12px!important}
  .command-metrics{gap:8px!important}
  .command-metrics button{min-height:82px!important;padding:11px!important}

  /* Targets táctiles y formularios */
  button,.button,[role="button"],.small-action,.br8125-btn{
    min-height:var(--br-iphone-touch)!important;
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }
  input:not([type="checkbox"]):not([type="radio"]),select,textarea{
    min-height:46px!important;
    max-width:100%!important;
    font-size:16px!important;
    line-height:1.35!important;
    box-sizing:border-box!important;
  }
  textarea{min-height:96px!important}
  input[type="checkbox"],input[type="radio"]{min-width:22px;min-height:22px}
  .actions,.new-actions,.br8125-actions,.report-card-actions,.preview-modal-actions,
  .brw-schedule-actions,.brw-agenda-actions{
    gap:8px!important;
  }
  .actions>button,.new-actions>button,.br8125-actions>button{
    min-width:0!important;
  }

  /* Grillas: una columna cuando el ancho del teléfono no alcanza */
  .form-grid,.specialized-grid,.module-process,.dashboard-grid,.indicator-grid,.kpis,
  .new-actions,.investigation-fields,.statement-grid,.investigation-side,
  .consequence-matrix,.investigation-output-grid,.people-results,.people-grid,
  .brdi-grid,.brdi-question{
    grid-template-columns:minmax(0,1fr)!important;
  }
  .brdi-actions,.brw-schedule-actions{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}

  /* Sin scroll horizontal de página ni de tablas comunes */
  table{width:100%!important;max-width:100%!important;table-layout:fixed!important;overflow:visible!important}
  th,td{white-space:normal!important;overflow-wrap:anywhere!important;word-break:normal!important;padding-left:7px!important;padding-right:7px!important}
  .table-wrap,.table-container,.brdi-result,.report-table-wrap{max-width:100%!important;overflow-x:hidden!important}
  img,svg,canvas,video,iframe{max-width:100%!important}
  pre,code{max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere}

  /* Hojas y diálogos: siempre dentro del viewport del iPhone */
  .mobile-more-sheet,.mobile-sheet,.preview-modal,.image-viewer,.br8268-dialog,
  .br820-export-sheet,.br-canvas-dialog,.assistant-sheet,.assistant-content{
    max-width:100vw!important;
  }
  .mobile-more-panel,.sheet-content,.preview-modal-card,.br820-export-card,.assistant-content{
    width:100%!important;
    max-width:100%!important;
    max-height:calc(100dvh - 74px)!important;
    border-radius:22px 22px 0 0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    padding-bottom:max(18px,env(safe-area-inset-bottom,0px))!important;
  }
  .mobile-more-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  .mobile-more-grid button{min-height:78px!important;padding:10px 7px!important}

  /* Barra inferior: fija, segura y siempre alcanzable */
  body:not(.br-cover-open)>.mobile-nav,
  body:not(.br-cover-open) .mobile-nav{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100%!important;
    max-width:none!important;
    height:calc(var(--br-iphone-nav-h) + env(safe-area-inset-bottom,0px))!important;
    min-height:calc(var(--br-iphone-nav-h) + env(safe-area-inset-bottom,0px))!important;
    padding:5px 5px max(5px,env(safe-area-inset-bottom,0px))!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr) 68px minmax(0,1fr) minmax(0,1fr)!important;
    background:rgba(255,255,255,.985)!important;
    border-top:1px solid #e8e0ed!important;
    box-shadow:0 -8px 26px rgba(46,27,67,.13)!important;
    transform:none!important;
    z-index:10000!important;
    box-sizing:border-box!important;
    pointer-events:auto!important;
  }
  .mobile-nav-item{
    min-width:0!important;
    min-height:52px!important;
    padding:5px 2px!important;
    border-radius:12px!important;
  }
  .mobile-nav-item svg{width:21px!important;height:21px!important}
  .mobile-nav-item span{font-size:.61rem!important;line-height:1.05!important;white-space:nowrap!important}
  .mobile-nav-mic{
    width:58px!important;
    height:58px!important;
    min-width:58px!important;
    min-height:58px!important;
    margin-top:-19px!important;
    align-self:start!important;
    justify-self:center!important;
    z-index:2!important;
  }

  /* Acompañamiento visible, sin tapar navegación */
  .br-momento{
    left:9px!important;
    right:9px!important;
    bottom:calc(var(--br-iphone-nav-h) + 9px + env(safe-area-inset-bottom,0px))!important;
    width:auto!important;
    max-width:calc(100vw - 18px)!important;
    grid-template-columns:32px minmax(0,1fr)!important;
    padding:8px 10px!important;
    border-radius:14px!important;
    z-index:9400!important;
  }
  .br-momento__figure,.br-momento-figure{width:32px!important;height:32px!important;font-size:18px!important}
  .br-momento strong{font-size:11px!important;line-height:1.28!important}
  .br-momento small{font-size:8px!important}

  /* Elementos fijos secundarios nunca compiten con la barra inferior */
  .brx-guide,.bri-toast,.toast{bottom:calc(var(--br-iphone-nav-h) + 58px + env(safe-area-inset-bottom,0px))!important}

  /* Evita overflow accidental por decoraciones/transforms */
  .view.active::before,.view.active::after,.card::before,.card::after{max-width:100vw}
  [style*="min-width"]{max-width:100%!important}
}

@media (max-width:390px){
  .view{padding-inline:10px!important}
  .mobile-more-grid{gap:7px!important}
  .brdi-actions,.brw-schedule-actions{grid-template-columns:minmax(0,1fr)!important}
  .brw-tools>div{grid-template-columns:minmax(0,1fr)!important}
  .mobile-nav-item span{font-size:.58rem!important}
  .br-momento{left:7px!important;right:7px!important}
}

@media (max-width:699px) and (orientation:landscape) and (max-height:520px){
  :root{--br-iphone-nav-h:64px}
  .mobile-nav-mic{width:54px!important;height:54px!important;min-width:54px!important;min-height:54px!important;margin-top:-17px!important}
  .br-momento{bottom:calc(var(--br-iphone-nav-h) + 7px + env(safe-area-inset-bottom,0px))!important}
}
