/* SHEPHERDS V26 — MILAN KEYBOARD / VISUAL-VIEWPORT CONTROL
   Additive over V25. Keeps the Milan application visually closed over the page while iOS Safari
   changes the visual viewport, and turns the intake into the primary scroll surface while typing. */
:root{--sage-v26-vh:100dvh;--sage-v26-top:0px;--sage-v26-kb:0px}
body.v26-site.sage-lock{overflow:hidden!important;overscroll-behavior:none!important}
.v26-site .sage-portal{
  position:fixed!important;inset:0!important;width:100vw!important;height:auto!important;max-height:none!important;
  overflow:hidden!important;isolation:isolate!important;background:#080a08!important
}
.v26-site .sage-backdrop{position:absolute!important;inset:0!important;background:#080a08!important;opacity:1!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
.v26-site .sage-shell{
  position:fixed!important;left:0!important;right:0!important;bottom:auto!important;
  top:var(--sage-v26-top,0px)!important;height:var(--sage-v26-vh,100dvh)!important;max-height:var(--sage-v26-vh,100dvh)!important;
  min-height:0!important;width:100%!important;max-width:100%!important;margin:0!important;border-radius:0!important;
  display:flex!important;flex-direction:column!important;overflow:hidden!important;z-index:2!important
}
.v26-site .sage-topbar{flex:0 0 auto!important}
.v26-site .sage-body{display:flex!important;flex:1 1 auto!important;min-height:0!important;overflow:hidden!important}
.v26-site .sage-chat{display:flex!important;flex:1 1 auto!important;min-height:0!important;flex-direction:column!important;overflow:hidden!important}
.v26-site .sage-thread{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important}
.v26-site .sage-composer{flex:0 0 auto!important;min-height:0!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior:contain!important}
.v26-site .sage-composer-inner{min-width:0!important}
.v26-site .sage-field,.v26-site .sage-field input,.v26-site .sage-field select,.v26-site .sage-field textarea{scroll-margin-top:74px!important;scroll-margin-bottom:88px!important}

/* Keyboard mode: conversation history yields the available viewport to the active intake.
   The question + Milan chrome stay visible while every business-brief field remains reachable. */
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-topbar{min-height:56px!important;padding:6px 10px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-mark{width:34px!important;height:34px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-brand b{font-size:16px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-brand small,.v26-site .sage-portal[data-sage-keyboard="true"] .sage-top-context{display:none!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-body{height:auto!important;min-height:0!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-context-rail{display:none!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-thread{display:none!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-composer{
  display:block!important;flex:1 1 auto!important;height:auto!important;max-height:none!important;min-height:0!important;
  overflow-y:auto!important;padding:0 12px max(16px,env(safe-area-inset-bottom))!important;background:#080a08!important
}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-composer-inner{padding-top:0!important;min-height:100%!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-question-label{
  position:sticky!important;top:0!important;z-index:90!important;margin:0 -2px 10px!important;padding:12px 2px 10px!important;
  background:linear-gradient(180deg,#080a08 72%,rgba(8,10,8,.92) 88%,rgba(8,10,8,0))!important
}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-batch.sage-v16-brief{display:grid!important;grid-template-columns:1fr!important;max-height:none!important;overflow:visible!important;padding:0 0 12px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-v16-group{grid-template-columns:1fr!important;padding:12px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-v17-contact{grid-template-columns:1fr!important}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-batch-actions{
  position:sticky!important;bottom:0!important;z-index:95!important;margin-top:12px!important;
  padding:18px 0 max(10px,env(safe-area-inset-bottom))!important;background:linear-gradient(180deg,rgba(8,10,8,0),#080a08 32%)!important
}
.v26-site .sage-portal[data-sage-keyboard="true"] .sage-batch-actions .sage-continue{min-height:56px!important;width:100%!important}
.v26-site .sage-portal[data-sage-keyboard="true"] :is(input,select,textarea){font-size:16px!important;min-height:52px!important}
.v26-site .sage-portal[data-sage-keyboard="true"] textarea{min-height:116px!important}

/* Narrow Safari viewports: no hidden composer cap, no exposed page below Milan. */
@media(max-width:900px){
 .v26-site .sage-portal{height:auto!important;max-height:none!important}
 .v26-site .sage-shell{top:var(--sage-v26-top,0px)!important;height:var(--sage-v26-vh,100dvh)!important;max-height:var(--sage-v26-vh,100dvh)!important}
 .v26-site .sage-composer{max-height:min(62%,620px)!important}
 .v26-site .sage-portal[data-sage-keyboard="true"] .sage-composer{max-height:none!important}
}
@media(max-width:560px){
 .v26-site .sage-topbar{padding-inline:max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right))!important}
 .v26-site .sage-portal[data-sage-keyboard="true"] .sage-close{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important}
}
