/* HyTerm V16 compact-desktop responsive guard.
   Prevents conversation + right-panel chrome from squeezing the transcript. */
@media (min-width:901px) and (max-width:1180px){
  body.hyterm-v16 #ht-shell{padding:8px;gap:8px}
  body.hyterm-v16 #ht-header{
    min-height:52px;
    padding:8px 10px;
    gap:8px;
    flex-wrap:wrap;
  }
  body.hyterm-v16 #ht-header-tabs{min-width:0;flex:1 1 auto}
  body.hyterm-v16 #ht-hdr-btns{
    min-width:0;
    max-width:100%;
    gap:5px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    scrollbar-width:thin;
  }
  body.hyterm-v16 #ht-hdr-btns .ht-hdr-btn{
    flex:0 0 auto;
    min-height:34px;
    padding:4px 8px;
    font-size:10px;
  }

  body.hyterm-v16 #ht-body{gap:8px;min-width:0}
  body.hyterm-v16 #ht-conversation-rail{
    width:clamp(210px,23vw,250px);
    flex:0 0 auto;
  }
  body.hyterm-v16 #ht-messages-col{
    min-width:0;
    flex:1 1 auto;
  }
  body.hyterm-v16 #ht-messages{
    padding:18px clamp(12px,2.5vw,30px) 172px;
  }
  body.hyterm-v16 #ht-thinking,
  body.hyterm-v16 #ht-pipeline{
    margin-left:clamp(12px,2.5vw,30px);
    margin-right:clamp(12px,2.5vw,30px);
  }
  body.hyterm-v16 #ht-composer{
    left:clamp(10px,2vw,24px);
    right:clamp(10px,2vw,24px);
    bottom:10px;
  }

  /* The old 340px dock must stop consuming chat width in the middle band. */
  body.hyterm-v16 #ht-right.open{
    display:flex!important;
    position:fixed!important;
    top:70px;
    right:10px;
    bottom:10px;
    left:auto;
    width:min(400px,calc(100vw - 20px))!important;
    height:auto;
    z-index:260;
    overflow:auto;
    border:1px solid var(--v16-line-strong);
    border-radius:var(--v16-radius-lg);
    box-shadow:0 24px 70px rgba(0,0,0,.52),var(--v16-glow);
    backdrop-filter:blur(22px);
  }

  body.hyterm-v16 .ht-agent-transcript{
    min-width:0;
    max-width:100%;
    margin-left:clamp(12px,2.5vw,30px);
    margin-right:clamp(12px,2.5vw,30px);
  }
  body.hyterm-v16 .ht-agent-transcript-output,
  body.hyterm-v16 .ht-agent-transcript-line{
    min-width:0;
    overflow-wrap:anywhere;
    word-break:break-word;
  }

  /* System-work surfaces remain overlays; never become a third layout column. */
  .hfl-panel{
    inset:60px 10px 10px!important;
    width:auto!important;
    max-width:none!important;
  }
  .hfl-stages{grid-template-columns:repeat(2,minmax(0,1fr))}
  .hfl-repair .hfl-lane{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (min-width:901px) and (max-width:1040px){
  body.hyterm-v16 #ht-conversation-rail{
    width:clamp(190px,21vw,220px);
    padding:6px;
  }
  body.hyterm-v16 .ht-conv-row{min-height:62px;padding:8px}
  body.hyterm-v16 .ht-conv-name{font-size:12px}
  body.hyterm-v16 #ht-messages{padding-left:12px;padding-right:12px}
  body.hyterm-v16 #ht-thinking,
  body.hyterm-v16 #ht-pipeline{margin-left:12px;margin-right:12px}
  body.hyterm-v16 #ht-composer{left:10px;right:10px}
}

@media (max-width:900px){
  /* Existing phone/tablet behavior owns the layout below this point. */
  body.hyterm-v16 #ht-right.open{
    position:fixed;
    width:100%!important;
  }
}



/* Tablet/phone operator touch contract: visible primary controls are thumb-safe. */
@media(max-width:900px){
  body.hyterm-v16 #ht-header button,
  body.hyterm-v16 #ht-tab-bar button,
  body.hyterm-v16 #ht-composer button,
  body.hyterm-v16 #ht-conversation-rail button,
  body.hyterm-v16 #ht-right button,
  body.hyterm-v16 .ht-activity-summary button,
  body.hyterm-v16 .ht-agent-transcript-head,
  body.hyterm-v16 #ht-conversations-dialog button{
    min-height:44px!important;
    min-width:44px;
  }
}
