/* StudentSOS v20.11.7 — definitive mobile project/chat layout.
   Scoped to project pages so dashboard/profile layouts cannot be affected. */
.s20117-project-page .s18-chat-shell,
.s20117-project-page .s18-chat-head,
.s20117-project-page .s18-chat-stream,
.s20117-project-page .s18-composer-wrap,
.s20117-project-page .s18-composer,
.s20117-project-page .s204-long-scroll{box-sizing:border-box;min-width:0}

@media(max-width:820px){
  body.s20117-project-page{
    width:100%!important;max-width:100%!important;height:100dvh!important;min-height:100dvh!important;
    margin:0!important;padding:0!important;overflow:hidden!important;background:#fff!important;
  }
  body.s20117-project-page .s8-app-mobile-head{display:none!important}
  body.s20117-project-page .s18-project{
    display:block!important;width:100%!important;max-width:100vw!important;height:100dvh!important;min-height:0!important;max-height:100dvh!important;
    margin:0!important;padding:0!important;overflow:hidden!important;background:#fff!important;
  }
  body.s20117-project-page .s18-rail{display:none!important}
  body.s20117-project-page .s18-chat-shell{
    display:flex!important;flex-direction:column!important;width:100%!important;max-width:100vw!important;height:100dvh!important;min-height:0!important;max-height:100dvh!important;
    margin:0!important;padding:0!important;overflow:hidden!important;background:#fff!important;
  }

  /* One compact, predictable header: title first, controls second. */
  body.s20117-project-page .s18-chat-head{
    position:relative!important;inset:auto!important;top:auto!important;z-index:35!important;display:block!important;flex:0 0 auto!important;
    width:100%!important;max-width:100%!important;min-height:0!important;margin:0!important;
    padding:8px 10px 7px!important;border-bottom:1px solid #e8edf5!important;background:#fff!important;overflow:visible!important;
    backdrop-filter:none!important;
  }
  body.s20117-project-page .s2092-project-heading{
    display:grid!important;grid-template-columns:36px minmax(0,1fr)!important;align-items:center!important;gap:8px!important;
    width:100%!important;max-width:none!important;min-width:0!important;margin:0!important;
  }
  body.s20117-project-page .s210-mobile-brand{display:none!important}
  body.s20117-project-page .s2092-project-back{
    display:grid!important;place-items:center!important;width:36px!important;height:36px!important;min-width:36px!important;margin:0!important;padding:0!important;
    border:1px solid #e2e8f2!important;border-radius:12px!important;background:#f8faff!important;color:#334155!important;
  }
  body.s20117-project-page .s18-chat-title{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important}
  body.s20117-project-page .s18-chat-title small{
    display:block!important;margin:0 0 1px!important;font-size:9px!important;line-height:1.25!important;color:#8590a3!important;
    white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
  }
  body.s20117-project-page .s18-chat-title h1{
    display:block!important;width:100%!important;max-width:100%!important;margin:0!important;font-size:14px!important;line-height:1.28!important;font-weight:800!important;
    white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;word-break:normal!important;
  }
  body.s20117-project-page .s18-chat-actions{
    display:flex!important;align-items:center!important;justify-content:flex-start!important;flex-wrap:nowrap!important;gap:6px!important;
    width:100%!important;max-width:100%!important;min-width:0!important;margin:7px 0 0!important;padding:0 0 1px!important;
    overflow-x:auto!important;overflow-y:visible!important;scrollbar-width:none!important;-webkit-overflow-scrolling:touch!important;
  }
  body.s20117-project-page .s18-chat-actions::-webkit-scrollbar{display:none!important}
  body.s20117-project-page .s18-chat-actions>a,
  body.s20117-project-page .s18-chat-actions>button,
  body.s20117-project-page .s18-chat-actions>details{flex:0 0 auto!important;min-width:0!important;max-width:none!important;margin:0!important}
  body.s20117-project-page .s18-chat-actions a,
  body.s20117-project-page .s18-chat-actions button,
  body.s20117-project-page .s18-chat-actions summary{
    min-height:32px!important;padding:0 10px!important;border-radius:10px!important;font-size:10px!important;line-height:1!important;
    writing-mode:horizontal-tb!important;white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;
  }
  body.s20117-project-page .s18-chat-actions [data-share-project]{display:none!important}
  body.s20117-project-page .s18-chat-actions .s2092-action-primary{font-size:10px!important}
  body.s20117-project-page .s18-chat-actions .s2092-action-primary:after{content:none!important}
  body.s20117-project-page .s18-chat-actions details>div{top:86px!important;right:8px!important;max-width:calc(100vw - 16px)!important}

  /* Tutor tools stay horizontal instead of squeezing the whole page. */
  body.s20117-project-page .s2092-tutor-tools{
    flex:0 0 auto!important;width:calc(100% - 16px)!important;max-width:calc(100% - 16px)!important;margin:7px 8px 0!important;
    overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap!important;
  }

  /* The central work area owns the remaining viewport; composer never floats halfway up the page. */
  body.s20117-project-page .s204-long-scroll{
    flex:1 1 auto!important;min-height:0!important;width:100%!important;max-width:100%!important;overflow-y:auto!important;overflow-x:hidden!important;
    overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;padding:0 0 10px!important;
  }
  body.s20117-project-page .s18-project:not(.is-long-project) .s18-chat-stream{
    flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;
  }
  body.s20117-project-page .s18-chat-stream{
    width:calc(100% - 20px)!important;max-width:920px!important;min-width:0!important;margin:0 auto!important;padding:14px 0 12px!important;
    gap:16px!important;scroll-padding-bottom:16px!important;
  }
  body.s20117-project-page .s18-project.is-long-project .s18-chat-stream{
    width:calc(100% - 20px)!important;max-width:none!important;margin:12px 10px 0!important;padding:14px 0 18px!important;min-height:220px!important;
  }
  body.s20117-project-page .s18-project.is-long-project .s18-doc-studio{
    width:calc(100% - 16px)!important;max-width:none!important;margin:8px 8px 0!important;max-height:none!important;overflow:visible!important;
  }
  body.s20117-project-page .s18-msg{width:100%!important;max-width:100%!important;min-width:0!important;grid-template-columns:30px minmax(0,1fr)!important;gap:8px!important}
  body.s20117-project-page .s18-message-wrap,body.s20117-project-page .s18-message{max-width:100%!important;min-width:0!important;overflow-wrap:anywhere!important}
  body.s20117-project-page .s18-msg.user .s18-message-wrap{max-width:min(88%,620px)!important;margin-left:auto!important}
  body.s20117-project-page .s18-thinking{max-width:min(100%,620px)!important;min-width:0!important}

  /* Composer is a compact flex footer inside the viewport. */
  body.s20117-project-page .s18-composer-wrap{
    position:relative!important;inset:auto!important;bottom:auto!important;z-index:40!important;flex:0 0 auto!important;
    width:100%!important;max-width:100%!important;margin:0!important;padding:7px 8px calc(8px + env(safe-area-inset-bottom))!important;
    border-top:1px solid #e9edf4!important;background:#fff!important;box-shadow:0 -8px 24px rgba(30,41,59,.04)!important;
  }
  body.s20117-project-page .s18-composer{
    width:100%!important;max-width:920px!important;min-width:0!important;margin:0 auto!important;padding:7px!important;
    border-radius:17px!important;box-shadow:0 5px 18px rgba(30,41,59,.07)!important;
  }
  body.s20117-project-page .s18-composer textarea{
    width:100%!important;min-height:42px!important;max-height:96px!important;margin:0!important;padding:7px 8px!important;
    font-size:16px!important;line-height:1.42!important;box-sizing:border-box!important;
  }
  body.s20117-project-page .s18-composer-bottom{display:flex!important;align-items:center!important;gap:6px!important;width:100%!important;min-width:0!important}
  body.s20117-project-page .s18-quick{
    display:flex!important;flex:1 1 auto!important;min-width:0!important;max-width:none!important;gap:5px!important;overflow-x:auto!important;overflow-y:hidden!important;flex-wrap:nowrap!important;
    scrollbar-width:none!important;-webkit-overflow-scrolling:touch!important;
  }
  body.s20117-project-page .s18-quick::-webkit-scrollbar{display:none!important}
  body.s20117-project-page .s18-quick button{flex:0 0 auto!important;min-height:34px!important;padding:6px 9px!important;font-size:10px!important;white-space:nowrap!important}
  body.s20117-project-page .s18-upload-button,body.s20117-project-page .s18-send{width:38px!important;height:38px!important;min-width:38px!important;flex:0 0 38px!important}
  body.s20117-project-page .s18-composer-meta{display:flex!important;align-items:center!important;justify-content:flex-start!important;min-height:18px!important;padding:4px 7px 0!important;font-size:8px!important}
  body.s20117-project-page .s18-composer-meta span:last-child{display:none!important}

  body.s20117-project-page .s18-context{top:0!important;bottom:0!important;height:100dvh!important;max-height:100dvh!important;width:min(360px,94vw)!important}
  body.s20117-project-page .s18-context-backdrop{inset:0!important}
}

@media(max-width:430px){
  body.s20117-project-page .s18-chat-head{padding-inline:8px!important}
  body.s20117-project-page .s18-chat-actions a,
  body.s20117-project-page .s18-chat-actions button,
  body.s20117-project-page .s18-chat-actions summary{padding-inline:8px!important;font-size:9px!important}
  body.s20117-project-page .s18-chat-stream{width:calc(100% - 16px)!important}
  body.s20117-project-page .s18-project.is-long-project .s18-chat-stream{width:calc(100% - 16px)!important;margin-inline:8px!important}
  body.s20117-project-page .s18-msg.user .s18-message-wrap{max-width:92%!important}
}
