/* R103 — Lite ergonomics exception cleanup after resize matrix. */
@container hyos-lite-window (max-width:620px){
  [data-hyos-host] .hydr-side{scrollbar-width:thin!important}
  [data-hyos-host] .hydr-brand{flex:0 0 auto!important;min-width:max-content!important}
  [data-hyos-host] .hydr-nav{display:flex!important;flex:0 0 auto!important;gap:4px!important;min-width:max-content!important}
  [data-hyos-host] .hydr-nav button{
    flex:0 0 auto!important;
    width:auto!important;
    min-width:max-content!important;
    white-space:nowrap!important;
    padding-inline:7px!important
  }
  [data-hyos-host] .hycrm-detail>.hycrm-btn,
  [data-hyos-host] .hywh-row>.hywh-btn{
    width:auto!important;
    min-width:max-content!important;
    justify-self:start!important
  }
  [data-hyos-host] .hyos-chat-call,
  [data-hyos-host] .hyos-chat-tool:not(.hyos-chat-call):not(:first-child):not(:nth-child(2)){
    width:30px!important;
    min-width:30px!important;
    max-width:30px!important;
    height:30px!important;
    min-height:30px!important;
    max-height:30px!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:9px!important
  }
  [data-hyos-host] .os-window .window-body .hymedia-lite>.hymedia-controls{
    grid-template-columns:repeat(5,32px) minmax(0,1fr)!important;
    justify-content:start!important;
    align-items:center!important
  }
  [data-hyos-host] .os-window .window-body .hymedia-lite>.hymedia-controls .hymedia-btn{
    width:32px!important;
    min-width:32px!important;
    max-width:32px!important
  }
  [data-hyos-host] .os-window .window-body .hymedia-lite>.hymedia-controls input[aria-label=Seek]{
    grid-column:1/5!important;
    min-width:0!important
  }
  [data-hyos-host] .os-window .window-body .hymedia-lite>.hymedia-controls input[aria-label=Volume]{
    grid-column:5/7!important;
    min-width:0!important
  }
}
@container hyos-lite-window (max-width:420px){
  [data-hyos-host] .hycrm-detail>.hycrm-btn,
  [data-hyos-host] .hywh-row>.hywh-btn{
    width:auto!important;
    max-width:100%!important
  }
  [data-hyos-host] .hyvox-side-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:4px!important
  }
  [data-hyos-host] .hyvox-side-actions .hyvox-btn{
    flex:0 1 auto!important;
    width:auto!important;
    min-width:max-content!important
  }
}

/* R108 visual audit — small-window layout, constrained to authenticated Lite windows. */
@container hyos-lite-window (max-width:620px){
  /* Search/filter and actions receive dedicated, readable cells. */
  [data-hyos-host] .os-window .window-body .hytk-toolbar{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
    align-items:stretch!important;
  }
  [data-hyos-host] .os-window .window-body .hytk-toolbar>*{
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    min-height:38px!important;
    padding:8px 10px!important;
    font-size:12px!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  /* Translation controls need sufficient space for both languages. */
  [data-hyos-host] .os-window .window-body .hyvox-grid{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:repeat(2,minmax(185px,auto))!important;
    flex:0 1 auto!important;
    min-height:0!important;
    gap:8px!important;
  }
  [data-hyos-host] .os-window .window-body .hyvox-side{
    min-height:185px!important;
    padding:9px!important;
  }
  [data-hyos-host] .os-window .window-body .hyvox-input{
    min-height:78px!important;
  }
  [data-hyos-host] .os-window .window-body .hyvox-btn{
    min-height:36px!important;
    height:auto!important;
    padding:7px 10px!important;
    font-size:11px!important;
    line-height:1.25!important;
  }
  [data-hyos-host] .os-window .window-body .hyvox-side-actions .hyvox-btn{
    flex:1 1 calc(50% - 8px)!important;
    min-width:0!important;
    max-width:none!important;
  }
  /* A horizontal ledger is intentional, but its affordance was invisible. */
  [data-hyos-host] .os-window .window-body .hywh-table{
    overflow-x:auto!important;
    scrollbar-width:thin!important;
    scrollbar-color:#6ccde7 #0b2134!important;
  }
  [data-hyos-host] .os-window .window-body .hywh-table::before{
    content:"Swipe horizontally to view inventory columns →";
    display:block;
    position:sticky;
    left:0;
    width:max-content;
    max-width:100%;
    z-index:2;
    font-size:11px;
    color:#a9dcf1;
    padding:7px 10px 4px;
    pointer-events:none;
  }
}

/* Inventory ledger stays a horizontal multi-column table on narrow windows. */
@container hyos-lite-window (max-width:620px){
  [data-hyos-host] .os-window .window-body .hywh-table>.hywh-row{
    display:grid!important;
    min-width:560px!important;
    grid-template-columns:minmax(120px,1.2fr) minmax(160px,1.7fr) repeat(3,minmax(72px,.7fr))!important;
    align-items:center!important;
    gap:7px!important;
  }
  [data-hyos-host] .os-window .window-body .hywh-table>.hywh-row>*{
    min-width:0!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
}

/* Drive must not keep the desktop sidebar beside a phone-sized workspace. */
@container hyos-lite-window (max-width:620px){
  [data-hyos-host] .os-window .window-body .hydr-app{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    min-width:0!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-side{
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    gap:7px!important;
    padding:8px!important;
    min-width:0!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    border-right:0!important;
    border-bottom:1px solid #76dfff33!important;
    scrollbar-width:thin!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-nav{
    display:flex!important;
    flex-direction:row!important;
    gap:5px!important;
    min-width:max-content!important;
    flex:0 0 auto!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-nav button{
    flex:0 0 auto!important;
    min-width:max-content!important;
    white-space:nowrap!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-main{
    min-width:0!important;
    width:100%!important;
    padding:10px!important;
  }
}

/* R109 — nav discoverability: full-width tabs row and persistent swipe cue. */
@container hyos-lite-window (max-width:620px){
  [data-hyos-host] .os-window .window-body .hydr-side{
    flex-wrap:wrap!important;
    overflow-x:visible!important;
    overflow-y:visible!important;
    align-content:start!important;
    gap:5px 8px!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-brand{
    order:1!important;
    flex:1 1 auto!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-new-wrap{
    order:2!important;
    flex:0 0 auto!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-nav{
    order:3!important;
    flex:1 1 100%!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:3px 0 5px!important;
    scrollbar-width:thin!important;
    scrollbar-color:#62cbe5 #0a1d31!important;
  }
  [data-hyos-host] .os-window .window-body .hydr-side::after{
    content:"Swipe tabs to see more →";
    order:4!important;
    display:block!important;
    flex:1 1 100%!important;
    text-align:right!important;
    padding-right:3px!important;
    color:#a7d8ed!important;
    font-size:10px!important;
    line-height:1.2!important;
    pointer-events:none!important;
  }
}

/* R110 — touch-target and field-width polish from the 390/768 visual audit. */
@container hyos-lite-window (max-width:900px){
  [data-hyos-host] .os-window .window-body :is(
    .hycal-btn,
    .hyof-button,
    .hyd-button,
    .hycrm-btn,
    .hytvl-btn,
    .hyedit-btn,
    .hyos-chat-new,
    .hyos-chat-mode,
    .hyvox-btn
  ){
    box-sizing:border-box!important;
    min-height:36px!important;
    height:auto!important;
    max-width:100%!important;
    padding-block:7px!important;
    line-height:1.2!important;
  }
  [data-hyos-host] .os-window .window-body:has(.hycrm-btn) select,
  [data-hyos-host] .os-window .window-body .hytk-toolbar select{
    box-sizing:border-box!important;
    min-height:36px!important;
    height:auto!important;
    padding-block:7px!important;
    line-height:1.2!important;
  }
  [data-hyos-host] .os-window .window-body :is(
    .hycal-toolbar,
    .hyof-toolbar,
    .hycrm-toolbar,
    .hytvl-toolbar,
    .hyedit-toolbar,
    .hyos-chat-modes,
    .hyvox-side-actions,
    .hytk-toolbar
  ){
    min-width:0!important;
    max-width:100%!important;
    flex-wrap:wrap!important;
  }
  [data-hyos-host] .os-window .window-body:has(.hyos-chat-mode) :is(form,div):has(>textarea){
    box-sizing:border-box!important;
    min-width:0!important;
    max-width:100%!important;
    flex-wrap:wrap!important;
  }
  [data-hyos-host] .os-window .window-body:has(.hyos-chat-mode) textarea{
    box-sizing:border-box!important;
    flex:1 1 12rem!important;
    width:auto!important;
    min-width:min(10rem,100%)!important;
    max-width:100%!important;
  }
}

@container hyos-lite-window (max-width:620px){
  [data-hyos-host] .os-window .window-body :is(
    .hycal-btn,
    .hyof-button,
    .hyd-button,
    .hycrm-btn,
    .hytvl-btn,
    .hyedit-btn,
    .hyos-chat-new,
    .hyos-chat-mode,
    .hyvox-btn,
    .hytk-toolbar select
  ){
    min-height:40px!important;
    padding-block:9px!important;
  }
  [data-hyos-host] .os-window .window-body:has(.hycrm-btn) select{
    min-height:40px!important;
    padding-block:9px!important;
  }
}

/* These two compact filters were too narrow at every captured breakpoint. */
[data-hyos-host] .os-window .window-body:has(.hycrm-btn) select,
[data-hyos-host] .os-window .window-body .hytk-toolbar select{
  box-sizing:border-box!important;
  min-width:min(10rem,100%)!important;
  max-width:100%!important;
}

/* R110 tablet chat: hidden sidebar must not reserve an empty 200px grid track. */
@container hyos-lite-window (min-width:621px) and (max-width:900px){
  [data-hyos-host] .os-window .window-body .hyos-native-chat{
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
  }
  [data-hyos-host] .os-window .window-body .hyos-chat-sidebar-head,
  [data-hyos-host] .os-window .window-body .hyos-chat-threads{
    display:none!important;
  }
  [data-hyos-host] .os-window .window-body .hyos-chat-center{
    grid-column:1 / -1!important;
    grid-row:2!important;
    min-width:0!important;
    width:100%!important;
  }
  [data-hyos-host] .os-window .window-body .hyos-chat-composer{
    min-width:0!important;
    max-width:100%!important;
  }
}
