/* NURIA_INBOX_MOBILE_V1: solo presentación de la bandeja en teléfonos. */
.ib-mobile-menu,.ib-mobile-filter-toggle,.ib-mobile-scrim{display:none}
@media (max-width:820px){
  html[data-inbox-page]{height:100%;overflow:hidden;overscroll-behavior:none}
  body.office.ib-active{
    position:fixed;top:var(--ib-mobile-top,0px);left:0;right:0;
    width:100%;height:var(--ib-mobile-height,100dvh);min-height:0;
    margin:0!important;padding:0!important;overflow:hidden;overscroll-behavior:none;
  }
  body.office.ib-active #office-root,
  body.office.ib-active .o-app.ib-app,
  body.office.ib-active .o-body,
  body.office.ib-active #office-main.ib-main{
    width:100%;height:100%;min-height:0!important;max-height:none;
    margin:0!important;padding:0!important;overflow:hidden;
  }
  body.office.ib-active .o-app.ib-app{
    display:grid;grid-template-columns:minmax(0,1fr)!important;
    border:0;border-radius:0;box-shadow:none;
  }
  body.office.ib-active .crm-inbox.ib-inbox{
    width:100%;height:100%!important;min-height:0!important;max-height:none!important;
    border:0;border-radius:0;margin:0;overflow:hidden;
  }
  body.office.ib-active .ib-inbox>.o-chat-list.ib-list{
    width:100%;height:100%!important;min-height:0!important;max-height:none!important;
    flex:1 1 100%;border:0;padding-bottom:env(safe-area-inset-bottom,0px);
  }
  body.office.ib-active .ib-inbox:not(.ib-chat-open)>.ib-chat{display:none!important}
  body.office.ib-active .ib-inbox.ib-chat-open>.ib-list{display:none!important}
  body.office.ib-active .ib-inbox.ib-chat-open>.ib-chat{
    display:flex!important;flex:1 1 100%;width:100%;height:100%;
    min-height:0!important;max-height:none!important;
  }
  body.office.ib-active .ib-list-top{
    flex:0 1 auto;min-height:0;max-height:70%;overflow-y:auto;overflow-x:hidden;
    padding: max(10px,env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) 10px max(12px,env(safe-area-inset-left,0px));
    gap:10px;overscroll-behavior:contain;
  }
  body.office.ib-active .ib-list-head{gap:8px;min-height:44px}
  body.office.ib-active .ib-list-head h1{flex:1;min-width:0;font-size:1.4rem;white-space:nowrap}
  body.office.ib-active .ib-mobile-menu,
  body.office.ib-active .ib-mobile-filter-toggle{
    display:inline-grid;place-items:center;flex:none;width:44px;height:44px;min-height:44px;
    padding:10px;border:0;border-radius:12px;background:transparent;color:var(--text);cursor:pointer;
  }
  .ib-mobile-menu svg,.ib-mobile-filter-toggle svg{width:22px;height:22px}
  body.office.ib-active .ib-list-head>.ib-mobile-menu{margin-left:-6px}
  body.office.ib-active .ib-list-head .ib-tools{gap:4px;flex:none}
  body.office.ib-active .ib-tools .ib-icon-btn{width:40px;height:44px;min-height:44px}
  body.office.ib-active .ib-availability{max-width:106px;min-height:40px;padding:0 6px}
  body.office.ib-active .ib-availability select{font-size:16px;max-width:84px;min-width:0}
  body.office.ib-active .ib-search{min-height:46px;padding:0 8px;gap:6px;flex:none}
  body.office.ib-active .ib-search input{height:44px;font-size:max(16px,1rem);flex:1;min-width:0}
  body.office.ib-active .ib-mobile-filter-toggle{position:relative;color:var(--muted);width:40px;padding:8px}
  body.office.ib-active .ib-mobile-filter-toggle[aria-expanded=true],
  body.office.ib-active .ib-mobile-filter-toggle[data-active-filters]{background:var(--accent-soft);color:var(--accent-ink)}
  .ib-mobile-filter-toggle[data-active-filters]::after{
    content:attr(data-active-filters);position:absolute;right:0;top:0;
    min-width:15px;line-height:15px;padding:0 3px;border-radius:99px;
    background:var(--accent);color:var(--on-accent);font-size:10px;font-weight:600;
  }
  body.office.ib-active .ib-search-submit{width:30px!important;min-width:30px;min-height:44px!important}
  body.office.ib-active .ib-tabs,
  html[data-inbox-size] body.office.ib-active .ib-tabs{
    display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;flex:none;
  }
  body.office.ib-active .ib-tabs .ib-tab,
  html[data-inbox-size] body.office.ib-active .ib-tabs .ib-tab{
    min-height:54px;gap:3px;padding:7px 4px;display:flex;flex-direction:column;
    align-items:center;justify-content:center;border-radius:10px;text-align:center;
  }
  body.office.ib-active .ib-tabs .ib-tab b{align-self:center;font-size:1.05rem;line-height:1.1}
  body.office.ib-active .ib-tabs .ib-tab span{font-size:.7rem;line-height:1.15;white-space:normal}
  body.office.ib-active .ib-help{display:none}
  body.office.ib-active .ib-list-top .ib-filters{display:none!important}
  body.office.ib-active .ib-list-top.ib-mobile-filters-open .ib-filters{
    display:grid!important;grid-template-columns:minmax(0,1fr);gap:6px;
  }
  body.office.ib-active .ib-filter{min-height:44px;flex:none}
  body.office.ib-active .ib-filter select{font-size:16px!important;min-height:42px}
  body.office.ib-active .ib-inbox .o-chat-list-body.ib-convs{
    flex:1 1 0%;height:auto;min-height:0!important;max-height:none!important;
    width:100%;overflow-y:auto!important;overflow-x:hidden;
    overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;
  }
  body.office.ib-active .ib-conv{min-height:86px;padding:12px;gap:10px;flex:none}
  body.office.ib-active .ib-conv .ib-avatar{width:46px;height:46px;flex-basis:46px}
  body.office.ib-active .ib-conv-main{min-width:0;overflow:hidden}
  body.office.ib-active .ib-conv-name{font-size:1rem!important}
  body.office.ib-active .ib-conv-prev{font-size:.875rem!important}
  body.office.ib-active .ib-conv-time{font-size:.75rem}
  body.office.ib-active .o-side.ib-rail{display:none!important;transform:none!important}
  body.office.ib-active .ib-app.menu-open>.o-side.ib-rail{
    display:flex!important;position:absolute!important;inset:0 auto 0 0;z-index:80;
    width:min(300px,86vw);height:100%;max-height:100%;transform:none!important;
    padding:max(12px,env(safe-area-inset-top,0px)) 12px max(12px,env(safe-area-inset-bottom,0px));
    align-items:stretch;
  }
  body.office.ib-active .ib-app.menu-open::after{display:none!important}
  body.office.ib-active .ib-app.menu-open>.ib-mobile-scrim{
    display:block;position:absolute;inset:0;z-index:70;width:100%;height:100%;
    border:0;border-radius:0;background:#111b2166;cursor:pointer;
  }
  body.office.ib-active .ib-chat .ib-chat-head{
    flex:none;min-height:0;padding:max(8px,env(safe-area-inset-top,0px)) 10px 8px;
    gap:7px;align-items:center;
  }
  body.office.ib-active .ib-chat-head .ib-back{
    display:grid!important;width:44px;height:44px;min-height:44px;padding:10px;
    border:0;border-radius:10px;background:transparent;
  }
  body.office.ib-active .ib-chat-head .ib-chat-person{flex:1 1 0;min-width:0;gap:8px}
  body.office.ib-active .ib-chat-person>div{min-width:0;flex:1}
  body.office.ib-active .ib-chat-person h2{font-size:1rem;overflow:hidden;text-overflow:ellipsis}
  body.office.ib-active .ib-chat-person .ib-avatar{width:40px;height:40px;flex-basis:40px}
  body.office.ib-active .ib-chat-sub{font-size:.75rem!important;gap:4px}
  body.office.ib-active .ib-chat-sub>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  body.office.ib-active .ib-chat-head .ib-actions{
    width:100%;min-width:0;flex:0 0 100%;justify-content:flex-start;flex-wrap:nowrap;
    overflow-x:auto;overflow-y:hidden;gap:6px;padding-bottom:2px;scrollbar-width:none;
  }
  body.office.ib-active .ib-actions>.o-actions{display:flex;flex-wrap:nowrap;flex:none}
  body.office.ib-active .ib-actions>*{flex-shrink:0}
  body.office.ib-active .ib-actions .o-field{min-height:44px;margin-right:0}
  body.office.ib-active .ib-actions select{font-size:16px;max-width:120px;min-height:42px}
  body.office.ib-active .ib-actions .o-btn,
  body.office.ib-active .ib-actions .ib-icon-btn{min-height:44px}
  body.office.ib-active .ib-actions::-webkit-scrollbar{display:none}
  body.office.ib-active .ib-chat #o-chat-messages.ib-msgs{
    flex:1 1 0%;height:auto;min-height:0!important;max-height:none!important;
    overflow-y:auto!important;overflow-x:hidden;overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;padding:12px;gap:8px;scrollbar-gutter:auto;
  }
  body.office.ib-active .ib-msgs .ib-bubble{max-width:92%;font-size:1rem}
  body.office.ib-active .ib-chat .ib-composer{
    flex:0 0 auto;min-height:0;max-height:none;padding:8px 10px max(8px,env(safe-area-inset-bottom,0px))!important;
    gap:7px!important;
  }
  body.office.ib-active .ib-composer-top{min-width:0;gap:6px}
  body.office.ib-active .ib-composer .ib-mode button{min-height:36px;font-size:.8rem}
  body.office.ib-active .ib-composer .ib-quick{max-width:100%;min-width:0;flex-wrap:nowrap;overflow-x:auto}
  body.office.ib-active .ib-composer>.ib-compose-row{gap:4px}
  body.office.ib-active .ib-composer .ib-round,
  body.office.ib-active .ib-composer .ib-attach{width:40px;min-width:40px;height:44px;min-height:44px}
  body.office.ib-active .ib-composer textarea.ib-draft{
    flex:1;min-width:0;width:0;font-size:max(16px,1rem);line-height:1.4;
    height:44px;min-height:44px;max-height:min(140px,25dvh);padding:10px 12px;resize:none;
  }
  body.office.ib-active .ib-composer .ib-hint{display:none}
  html[data-inbox-keyboard] body.office.ib-active .ib-chat-head .ib-actions,
  html[data-inbox-keyboard] body.office.ib-active .ib-composer .ib-quick{display:none!important}
  body.office.ib-active .ib-info{max-width:100%;width:100%!important;z-index:65}
  body.office.ib-active .ib-info-head{padding-top:env(safe-area-inset-top,0px)}
  body.office.ib-active #office-modal{padding:12px;max-height:var(--ib-mobile-height,100dvh)}
  body.office.ib-active #office-modal.ib-popover-root{padding:12px;justify-content:center;align-items:center}
  body.office.ib-active #office-modal .o-modal{max-height:calc(var(--ib-mobile-height,100dvh) - 24px);max-width:100%;width:100%}
  body.office.ib-active #office-toast{bottom:max(12px,env(safe-area-inset-bottom,0px));max-width:calc(100% - 24px)}
}
@media (min-width:821px) and (max-width:950px){
  body.office.ib-active .o-side.ib-rail{transform:none}
}
@media (max-width:360px){
  body.office.ib-active .ib-list-head h1{font-size:1.22rem}
  body.office.ib-active .ib-availability{max-width:80px}
  body.office.ib-active .ib-tools .ib-icon-btn{width:36px}
  body.office.ib-active .ib-conv{gap:8px}
}

/* NURIA_INBOX_MOBILE_V2: cada vista y cada fila caben en el ancho disponible. */
@media (max-width:820px){
  html[data-inbox-page]{width:100%;max-width:100%;overflow-x:hidden}
  body.office.ib-active .o-body,
  body.office.ib-active #office-main.ib-main,
  body.office.ib-active .crm-inbox.ib-inbox,
  body.office.ib-active .ib-inbox>.ib-list,
  body.office.ib-active .ib-inbox>.ib-chat{min-width:0!important;max-width:100%!important}
  body.office.ib-active .ib-inbox[data-inbox-mobile-view=list]>.ib-list{display:flex!important}
  body.office.ib-active .ib-inbox[data-inbox-mobile-view=list]>.ib-chat{display:none!important}
  body.office.ib-active .ib-inbox[data-inbox-mobile-view=chat]>.ib-list{display:none!important}
  body.office.ib-active .ib-inbox[data-inbox-mobile-view=chat]>.ib-chat{
    display:flex!important;width:100%;height:100%;flex:1 1 100%;
  }
  body.office.ib-active .ib-list-head h1{overflow:hidden;text-overflow:ellipsis;font-size:1.35rem}
  body.office.ib-active .ib-availability{max-width:128px;width:128px}
  body.office.ib-active .ib-availability select{max-width:none;width:100%;font-size:16px}
  body.office.ib-active .ib-inbox .ib-conv{
    display:grid!important;grid-template-columns:44px minmax(0,1fr) auto;
    align-items:center;gap:10px;width:100%!important;max-width:100%!important;min-width:0;
    min-height:82px;padding:10px 12px;overflow:hidden;box-sizing:border-box;
  }
  body.office.ib-active .ib-inbox .ib-conv:has(>button .crm-avatar),
  body.office.ib-active .ib-inbox .ib-conv:has(>a .crm-avatar){display:flex!important}
  body.office.ib-active .ib-inbox .ib-conv>:is(button,a):has(.crm-avatar){
    display:grid!important;grid-template-columns:44px minmax(0,1fr) auto;
    align-items:center;gap:10px;min-width:0!important;max-width:100%!important;width:100%;
  }
  body.office.ib-active .ib-conv>:is(button,a):has(.crm-avatar){
    flex:1 1 0%;padding:0;border:0;border-radius:0;background:transparent;color:inherit;
  }
  body.office.ib-active .ib-conv:has(>button .crm-avatar)>:not(button:has(.crm-avatar)),
  body.office.ib-active .ib-conv:has(>a .crm-avatar)>:not(a:has(.crm-avatar)){
    flex:0 0 auto;max-width:44px;position:static;
  }
  body.office.ib-active .ib-conv .crm-avatar{
    grid-column:1;width:44px;height:44px;min-width:44px;flex-basis:44px;
  }
  body.office.ib-active .ib-conv div:has(>.crm-row-title),
  body.office.ib-active .ib-conv .ib-conv-main{
    grid-column:2;min-width:0!important;width:100%;max-width:100%;
    display:flex;flex-direction:column;gap:3px;overflow:hidden;
  }
  body.office.ib-active .ib-conv .crm-row-title,
  body.office.ib-active .ib-conv .ib-conv-row{
    width:100%;min-width:0!important;max-width:100%;display:flex;align-items:center;
    justify-content:space-between;gap:7px;overflow:hidden;
  }
  body.office.ib-active .ib-conv .ib-conv-name,
  body.office.ib-active .ib-conv .crm-row-title>strong{
    flex:1 1 0%;width:0;min-width:0!important;max-width:100%;
    font-size:1rem!important;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  body.office.ib-active .ib-conv .ib-conv-time{
    margin-left:auto;flex:0 0 auto;white-space:nowrap;font-size:.6875rem;line-height:1.3;
  }
  body.office.ib-active .ib-conv .ib-conv-prev{
    flex:1 1 0%;width:0;min-width:0!important;max-width:100%;
    font-size:.875rem!important;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  body.office.ib-active .ib-conv .ib-who{
    max-width:100%;padding:1px 6px;font-size:.6875rem!important;line-height:1.35;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  body.office.ib-active .ib-conv .ib-unread{flex:0 0 auto;min-width:20px;line-height:20px;font-size:.6875rem}
  body.office.ib-active .ib-chat-head{width:100%;max-width:100%;box-sizing:border-box}
  body.office.ib-active .ib-chat-person{overflow:hidden}
  body.office.ib-active .ib-chat-person h2{max-width:100%;font-size:1rem;line-height:1.3}
  body.office.ib-active .ib-chat-person .ib-chat-sub{
    width:100%;min-width:0;flex-wrap:nowrap;overflow:hidden;font-size:.6875rem!important;
  }
  body.office.ib-active .ib-chat-sub>span:first-child{flex:1 1 0%;width:0;min-width:0}
  body.office.ib-active .ib-chat-sub .ib-status{flex:0 0 auto;max-width:40%;overflow:hidden;text-overflow:ellipsis;font-size:.625rem!important}
  body.office.ib-active .ib-chat #o-chat-messages.ib-msgs{min-width:0;max-width:100%;padding:10px}
  body.office.ib-active .ib-msgs .ib-bubble{
    box-sizing:border-box;min-width:0!important;width:fit-content!important;max-width:92%!important;
    white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font-size:.9375rem;line-height:1.5;
  }
  body.office.ib-active .ib-bubble .ib-bubble-label{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
  body.office.ib-active .ib-bubble .crm-photo,
  body.office.ib-active .ib-bubble .crm-audio{min-width:0;max-width:100%}
  body.office.ib-active .ib-bubble img,
  body.office.ib-active .ib-bubble audio,
  body.office.ib-active .ib-bubble video{max-width:100%!important;min-width:0;box-sizing:border-box}
  body.office.ib-active .ib-bubble audio{width:100%}
  body.office.ib-active .ib-chat .ib-composer{width:100%;max-width:100%;box-sizing:border-box}
  body.office.ib-active .ib-composer>.ib-compose-row{min-width:0;max-width:100%;width:100%}
  body.office.ib-active .ib-composer-top .ib-mode{max-width:100%}
}
@media (max-width:360px){
  body.office.ib-active .ib-list-head h1{font-size:1.2rem}
  body.office.ib-active .ib-availability{
    position:relative;width:40px;max-width:40px;min-width:40px;height:40px;padding:0;
    display:grid;place-items:center;
  }
  body.office.ib-active .ib-availability select{position:absolute;inset:0;width:100%;height:100%;opacity:0;font-size:16px}
}
