/* StudentSOS v4 — layout hardening + product polish */
html{overflow-x:hidden}
body{overflow-x:clip}
img,svg,video,canvas{max-width:100%}
button,input,textarea,select{font:inherit}
button,.btn,a{-webkit-tap-highlight-color:transparent}
.sos-logo,.brand-v3{min-width:0}.sos-logo-word{white-space:nowrap}.sos-logo-word b,.sos-logo-word strong{display:inline}
.s2-header .header-inner>*{min-width:0}.s2-header .brand{flex:0 1 auto}.s2-header .header-actions{flex:0 0 auto}
.s2-action-grid,.s2-showcase-grid,.s2-price-grid,.s2-tool-layout,.s2-app-content-grid,.footer-grid{min-width:0}
.s2-action-card>div,.s2-tool-list>a>div,.s2-project-row>div{min-width:0}
.s2-tool-list b,.s2-tool-list small{overflow-wrap:anywhere}
.s2-composer textarea,.workspace-composer textarea,.section-content,.project-modal-sheet textarea{line-height:1.55}
.preview-result{white-space:pre-wrap}

/* Product project workspace: v3 had 5 children in a 3-row grid. */
.project-workspace{height:calc(100dvh - 72px);min-height:520px}
.project-workspace.long-project-mode .workspace-main{grid-template-rows:auto minmax(220px,52vh) auto minmax(170px,1fr) auto;overflow:hidden}
.project-workspace.long-project-mode .document-studio{overflow:auto;margin-bottom:12px}
.project-workspace.long-project-mode .copilot-divider{min-height:32px;display:flex;align-items:center;justify-content:center}
.project-workspace.long-project-mode .conversation{min-height:0}
.workspace-head>div:first-child{min-width:0}.workspace-head h1{overflow-wrap:anywhere}
.workspace-actions{flex:0 0 auto}
.section-editor>header{grid-template-columns:42px minmax(0,1fr) auto auto}
.section-status{white-space:nowrap}
.section-generate,.save-section,.approve-section{white-space:nowrap}
.section-content{width:100%;box-sizing:border-box}
.context-item p{overflow-wrap:anywhere}

/* Mobile bottom nav: neutralize legacy .mobile-bottom a span {font-size:18px}. */
.s2-mobile-bottom a>span{font-size:9px!important;line-height:1!important;font-weight:650!important}
.s2-mobile-bottom a{min-width:0!important;gap:5px!important}
.s2-mobile-bottom .mobile-plus{display:grid;place-items:center;line-height:1}

/* Auth/forms */
.stack-form,.stack-form label,.project-modal-sheet form,.project-modal-sheet label{min-width:0}
.stack-form input,.stack-form textarea,.stack-form select,.project-modal-sheet input,.project-modal-sheet textarea{box-sizing:border-box;max-width:100%}
.legal-note{display:block;max-width:620px}

/* Admin diagnostics */
.diag-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.diag-card{display:flex;align-items:flex-start;gap:11px;background:#fff;border:1px solid #e4e9f2;border-radius:16px;padding:14px;min-width:0}
.diag-card b,.diag-card small{display:block}.diag-card b{font-size:12px;color:#111827}.diag-card small{font-size:10px;color:#758096;margin-top:4px;line-height:1.45;overflow-wrap:anywhere}
.diag-dot{width:11px;height:11px;border-radius:50%;margin-top:3px;flex:0 0 11px;background:#cbd5e1}.diag-dot.ok{background:#16a34a;box-shadow:0 0 0 4px #dcfce7}.diag-dot.bad{background:#ef4444;box-shadow:0 0 0 4px #fee2e2}
.diag-actions{margin-top:14px}.diag-result{margin-bottom:14px;padding:12px 14px;border-radius:14px;font-size:12px;font-weight:650;overflow-wrap:anywhere}.diag-result.ok{background:#ecfdf3;color:#166534;border:1px solid #bbf7d0}.diag-result.bad{background:#fff1f2;color:#9f1239;border:1px solid #fecdd3}.diag-help{margin-top:12px}.diag-help code{background:#eef3ff;color:#1d4ed8;border-radius:7px;padding:2px 5px}

@media(max-width:1100px){
  .project-workspace{grid-template-columns:54px minmax(0,1fr)!important}.context-panel{display:none!important}
  .diag-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:720px){
  body{min-width:320px}
  .s2-header .header-inner{width:calc(100% - 18px)!important}
  .s2-header .brand{max-width:58vw}.s2-header .header-actions{gap:6px!important}
  .s2-product-first .shell{width:calc(100% - 12px)!important}
  .s2-main-panel{overflow:hidden}
  .s2-composer-actions{flex-wrap:nowrap}.s2-composer-actions>div{min-width:0;display:flex}
  .s2-send{flex:0 0 auto}
  .s2-proof-strip{align-items:stretch}.s2-proof-strip>div{min-width:0}
  .s2-doc-mock{max-width:100%;overflow:hidden}
  .s2-referral-card{overflow:hidden}
  .s2-tool-composer{min-width:0}.s2-tool-composer-head{min-width:0}.s2-tool-composer-head>div{min-width:0}.s2-tool-composer-head b{overflow-wrap:anywhere}
  .s2-tool-layout>*{min-width:0}
  .auth-shell{min-height:calc(100dvh - 64px)}
  .stack-form input,.stack-form textarea,.stack-form select,.project-modal-sheet input,.project-modal-sheet textarea{font-size:16px!important}
  .project-workspace{height:calc(100dvh - 64px);min-height:0!important}
  .project-workspace.long-project-mode{height:auto;min-height:calc(100dvh - 64px)!important;display:block}
  .project-workspace.long-project-mode .workspace-main{display:block;height:auto;min-height:calc(100dvh - 64px);overflow:visible}
  .project-workspace.long-project-mode .document-studio{max-height:none;overflow:visible;margin:0 8px 14px!important}
  .project-workspace.long-project-mode .conversation{max-height:52vh;min-height:220px;overflow:auto}
  .project-workspace.long-project-mode .workspace-composer{position:sticky;bottom:0;z-index:25}
  .workspace-head{align-items:flex-start}.workspace-head h1{font-size:16px;line-height:1.25}
  .section-editor>header{grid-template-columns:28px minmax(0,1fr)!important;align-items:center!important}
  .section-status{grid-column:2;font-size:9px;justify-self:start}
  .section-generate{grid-column:1/3!important;width:100%;justify-content:center}
  .section-editor>footer{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.section-editor>footer>div{margin-left:auto;display:flex;gap:6px;flex-wrap:wrap}
  .compose-hints{min-width:0;max-width:calc(100vw - 130px)}
  .message{max-width:100%}
  .message-body{overflow-wrap:anywhere;min-width:0}
  .diag-grid{grid-template-columns:1fr}
  .admin-tabs{white-space:nowrap;-webkit-overflow-scrolling:touch}
}
@media(max-width:430px){
  .s2-header .brand{max-width:64vw}.sos-logo-word{font-size:15px!important}.sos-logo-mark{width:30px!important;height:30px!important;flex-basis:30px!important}
  .s2-header .header-actions .btn{font-size:9px!important;padding:8px 8px!important}
  .s2-main-intro h1{font-size:31px!important}.s2-main-intro p{max-width:31ch}
  .s2-composer-meta{display:grid!important;grid-template-columns:1fr!important}.s2-composer-meta span{font-size:10px!important}
  .s2-proof-strip{grid-template-columns:1fr 1fr!important}.s2-proof-strip strong{font-size:11px!important}.s2-proof-strip span{font-size:9px!important}
  .s2-showcase-head h2,.s2-pricing-head h2{font-size:28px!important}
  .s2-demo-copy h3,.s2-demo-card h3{font-size:22px!important}
  .s2-referral-card h2{font-size:27px!important}
  .trial-timeline{padding:12px}.trial-timeline b{font-size:22px}
  .s2-mobile-bottom{height:72px!important}
}
.studio-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;flex:0 0 auto}.studio-actions .btn{white-space:nowrap}
@media(max-width:720px){.document-studio-head{display:block!important}.studio-actions{justify-content:stretch;margin-top:14px}.studio-actions .btn{flex:1 1 160px}}
