/* =========================================================
   TRV V46 · reparación estructural + tema automático del sistema
   ========================================================= */

/*
  La plataforma superior ya no usa la antigua sidebar de app.css.
  app.css conserva una grilla histórica de 286px + contenido; al no existir
  sidebar en este layout, Safari colocaba todo el workspace en esa columna.
  Este bloque restablece una única columna real a ancho completo.
*/
html,body{
  width:100%;
  max-width:100%;
}
.trv43-app{
  display:block!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  height:100dvh!important;
}
.trv43-workspace{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:auto minmax(0,1fr)!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  height:100dvh!important;
  margin:0!important;
}
.trv43-topbar,
.trv43-primary-row,
.trv43-nav-row,
.trv43-main{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
}
.trv43-main{
  margin:0!important;
}

/* El tema pertenece al sistema operativo/navegador. No mostramos control solar/lunar. */
.theme-toggle{display:none!important}

/* Protección contra columnas heredadas o contenido que fuerce el ancho en Safari/iPadOS. */
.trv43-content,
.trv43-main > *,
.module-hero,
.section,
.panel,
.module-records,
.record44,
.record37,
.exec40-brief,
.exec40-map,
.exec40-inbox,
.exec40-semaphore,
.exec40-payables,
.exec40-trend{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

/* Cabecera estable a ancho completo. */
.trv43-primary-row{
  justify-items:stretch!important;
}
.trv43-heading{
  min-width:0!important;
}
.trv43-quick-actions{
  min-width:0!important;
}
.trv43-nav-scroll{
  min-width:0!important;
}

/* Guía: siempre contenida en el viewport y con acciones visibles. */
.guide-shade,.guide-focus,.guide-card{position:fixed!important}
.guide-card{
  box-sizing:border-box!important;
  max-width:min(440px,calc(100vw - 24px))!important;
  max-height:calc(100svh - 24px)!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
}
.guide-card .guide-actions{
  position:sticky!important;
  bottom:0!important;
  z-index:5!important;
  padding-bottom:max(14px,env(safe-area-inset-bottom))!important;
}

/* iPad / tablet horizontal: conservamos el dashboard ancho, no lo convertimos en columna estrecha. */
@media (min-width:821px) and (max-width:1180px){
  .trv43-app,.trv43-workspace{width:100%!important;max-width:none!important}
  .trv43-primary-row{grid-template-columns:minmax(0,1fr) auto!important}
  .trv43-quick-actions{justify-content:flex-end!important}
  .trv43-nav{min-width:max-content!important}
}

@media (max-width:820px){
  .trv43-workspace{height:100dvh!important}
  .trv43-primary-row{width:100%!important}
  .trv43-quick-actions{width:100%!important}
  .guide-card{
    left:12px!important;
    right:12px!important;
    bottom:12px!important;
    top:auto!important;
    width:auto!important;
    max-width:none!important;
    max-height:min(62svh,620px)!important;
  }
}
