/* Size the AI roster frame to its actual content area, not a shared backdrop. */
#ship-detail-mobile .sd-content:has(#sd-agents-panel.active){padding:12px 3vw 16px;gap:2%;background:none;min-height:0;flex:1}
#ship-detail-mobile .sd-content:has(#sd-agents-panel.active) .sd-visual-panel{background:url('../images/ui/agent-details/fleet-agent-roster-frame.svg') center/100% 100% no-repeat;min-height:0}
#ship-detail-mobile .sd-content:has(#sd-agents-panel.active) .sd-console-panel{height:100%;align-self:stretch;padding:0;min-height:0;overflow:hidden}
#ship-detail-mobile #sd-agents-panel.active{display:flex;flex-direction:column;flex:1;min-height:0;padding:16px 14px 20px;background:url('../images/ui/agent-details/fleet-agent-roster-frame.svg') center/100% 100% no-repeat;border:0;box-shadow:none;overflow:hidden}
#ship-detail-mobile #sd-agents-panel .sd-agents{flex:1;display:flex;flex-direction:column;min-height:0;height:100%;overflow:hidden;padding:0;margin:0}
#ship-detail-mobile #sd-agents-panel .sd-section-header{flex-shrink:0;margin:0 0 9px}
#ship-detail-mobile #sd-agents-panel .sd-agent-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(130px,1fr));grid-auto-rows:minmax(130px,1fr);flex:1;min-height:0;padding:0 4px 4px;gap:9px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#40b8dc transparent}
#ship-detail-mobile #sd-agents-panel .sd-agent-slot{min-height:130px;box-sizing:border-box;padding-bottom:33px;overflow:hidden}
#ship-detail-mobile #sd-agents-panel .sd-agent-change-btn,#ship-detail-mobile #sd-agents-panel .sd-agent-upgrade-btn,#ship-detail-mobile #sd-agents-panel .amp-agent-card-button{top:auto;bottom:6px;min-height:24px;height:auto;font-size:9px;line-height:1.2;padding:4px}
@media(max-height:600px){
#ship-detail-mobile .sd-content:has(#sd-agents-panel.active){padding:5px 2vw 9px}
#ship-detail-mobile #sd-agents-panel.active{padding:12px 10px 15px}
#ship-detail-mobile #sd-agents-panel .sd-section-header{margin-bottom:5px}
#ship-detail-mobile #sd-agents-panel .sd-agent-grid{grid-template-rows:repeat(2,minmax(104px,1fr));grid-auto-rows:minmax(104px,1fr);gap:5px}
#ship-detail-mobile #sd-agents-panel .sd-agent-slot{min-height:104px;padding-bottom:29px}
#ship-detail-mobile #sd-agents-panel .sd-agent-change-btn,#ship-detail-mobile #sd-agents-panel .sd-agent-upgrade-btn,#ship-detail-mobile #sd-agents-panel .amp-agent-card-button{font-size:8px;min-height:23px}
}
/* Anchor Sell Ship to its own visual panel instead of viewport coordinates. */
#ship-detail-mobile .sd-visual-panel{position:relative}
#ship-detail-mobile .sd-visual-panel .sd-actions{position:absolute;left:18px;right:18px;bottom:18px;top:auto;width:auto;margin:0;padding:0;background:none;border:0;transform:none;z-index:5}
#ship-detail-mobile .sd-visual-panel #sd-sell-btn{display:block;width:100%;min-height:38px;height:auto;margin:0;padding:9px 12px;clip-path:none;transform:none;border:1px solid #f07872;border-radius:4px;background:rgba(69,15,27,.75);color:#ffd6d3;font:700 12px/1.25 Orbitron,Arial;box-sizing:border-box}
@media(max-height:460px){#ship-detail-mobile .sd-visual-panel .sd-actions{left:12px;right:12px;bottom:14px}#ship-detail-mobile .sd-visual-panel #sd-sell-btn{min-height:32px;padding:7px 9px;font-size:10px}}
