/* Shared screen layout. Print reports keep their original paper dimensions. */
@media screen {
  html { overflow-x:clip; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  body { padding:0!important; font-size:14px; line-height:1.45; }
  :where(.app,main,.screen,.screen>*,section,article,header,footer,label,form,fieldset,dialog) { min-width:0; }
  .app { width:100%; max-width:none; margin:0; }
  .app main { width:100%; max-width:1600px; padding:24px; }
  .screen.active { max-width:none; }
  body .top { position:relative; top:auto; z-index:1; border-radius:0; padding:20px 24px; }
  .toprow { gap:20px; }
  .top-project-indicator { display:grid; gap:3px; }
  .pgc-shell { grid-template-columns:minmax(0,1fr); }
  .toprow>div { min-width:0; }
  .top h1 { font-size:clamp(21px,1.8vw,28px); line-height:1.2; }
  .top-project-branding { max-width:48%; min-width:0; }
  #top-project-name { white-space:normal; overflow-wrap:anywhere; font-size:clamp(16px,1.5vw,22px); }
  .private-online-toolbar { gap:12px; padding:8px 16px; }
  .private-online-toolbar>div:first-child { min-width:0; overflow-wrap:anywhere; }
  .private-online-actions { flex-wrap:wrap; }
  .private-local-warning { text-align:left; font-weight:500; }
  .sc-responsive-menu { display:none; }
  main :where(h2,h3,h4,p,label,strong) { overflow-wrap:anywhere; }
  .app main h2 { font-size:clamp(21px,1.8vw,27px); line-height:1.25; }
  .app main h3 { font-size:18px; line-height:1.3; }
  :where(.section-title,[class$='-heading'],[class$='-toolbar'],[class$='-actions']) { min-width:0; max-width:100%; flex-wrap:wrap; gap:12px; }
  :where(.section-title,[class$='-heading'])>div { min-width:0; }
  :where(input,select,textarea,button) { max-width:100%; }
  :where(input,select,textarea) { min-width:0; }
  :where(input[type='text'],input[type='email'],input[type='date'],input[type='number'],input[type='password'],input[type='search'],input[type='tel'],select,textarea) { width:100%; }
  :where(input[type='checkbox'],input[type='radio']) { flex-shrink:0; }
  button { white-space:normal; }
  .sc-create-primary { white-space:normal!important; line-height:1.3!important; }
  :where(img,video,canvas) { max-width:100%; }
  .sc-responsive-table { width:100%; max-width:100%; min-width:0; overflow:auto; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; border-radius:10px; }
  .sc-responsive-table:focus-visible { outline:3px solid #126ce5; outline-offset:2px; }
  .sc-responsive-table>table { margin:0; }
  /* Grid tracks must be allowed to shrink below long names and identifiers. */
  .sc-responsive-grid>* { min-width:0; }
  :where([class*='table-wrap'],[class*='table-scroll'],[class*='table-container']) { min-width:0; max-width:100%; overflow:auto; }
  :where([class*='tabs'],[role='tablist']) { min-width:0; max-width:100%; overflow-x:auto; overscroll-behavior-inline:contain; }
  :where([class*='tabs'],[role='tablist']) button { flex-shrink:0; }
  dialog:not([open]) { display:none; }
  dialog { box-sizing:border-box; max-width:calc(100vw - 24px)!important; max-height:calc(100dvh - 24px)!important; overflow:auto; overscroll-behavior:contain; }
  dialog :where(form,[class$='-body'],[class$='-content']) { min-width:0; max-width:100%; }
  dialog :where(h2,h3,p,label,strong) { overflow-wrap:anywhere; }
  dialog :where([class$='-actions'],footer) { flex-wrap:wrap; }
  .settings-letterhead-preview { grid-template-columns:minmax(0,200px) minmax(0,1fr) minmax(0,200px); }
  .settings-logo-drop { min-width:0; flex-wrap:wrap; }
  .settings-logo-preview { flex-shrink:1; }
  #settings .settings-tabs { display:flex; flex-wrap:wrap; overflow:visible; }
  #settings .settings-tabs button { flex:1 1 130px; min-width:0; padding:12px; }
}
@media screen and (min-width:1000px) {
  body .app { padding:0 0 24px 230px; }
  body .bottom-nav { position:fixed; inset:var(--sc-toolbar-height,52px) auto 0 0; width:230px; max-width:none; margin:0; padding:18px 12px; border-radius:0; border:0; border-right:1px solid var(--line); overflow-y:auto; display:flex; flex-direction:column; justify-content:flex-start; gap:6px; z-index:10; }
  .bottom-nav .nav-btn { display:flex; flex:0 0 auto; align-items:center; justify-content:flex-start; gap:10px; width:100%; min-width:0; min-height:44px; padding:10px 12px; font-size:14px; text-align:left; border-radius:10px; }
  .bottom-nav .nav-btn .ico { flex:0 0 22px; }
  .bottom-nav .nav-btn.active { background:#dff3ef; }
  .bottom-nav .app-brand { display:flex; margin:0 0 12px; padding:8px 8px 18px; }
  .bottom-nav .app-brand-logo { max-width:200px; }
  .mobile-app-brand { display:none; }
  .nav-section-label { display:block; }
  .private-local-warning { margin-left:230px; }
  .sc-sidebar-compact .app { padding-left:88px; }
  .sc-sidebar-compact .bottom-nav { width:88px; }
  .sc-sidebar-compact .private-local-warning { margin-left:88px; }
}
@media screen and (max-width:999px) {
  body .app { padding:0 0 24px; }
  body .app main { padding:18px; }
  body .top { padding:18px; }
  .mobile-app-brand { display:none; }
  .sc-responsive-menu { display:inline-flex; align-items:center; gap:6px; min-height:40px; border:1px solid #aac6c0!important; background:white!important; color:#0b5d5a!important; }
  body .bottom-nav { display:none; position:fixed; inset:var(--sc-toolbar-height,60px) auto 0 0; width:min(300px,88vw); max-width:none; margin:0; padding:16px; border:0; border-radius:0; background:#fff; overflow:auto; z-index:9999; box-shadow:10px 0 35px #1234; }
  body.sc-navigation-open .bottom-nav { display:flex; flex-direction:column; gap:6px; }
  .bottom-nav .nav-btn { display:flex; align-items:center; flex:0 0 auto; gap:12px; min-width:0; min-height:44px; width:100%; padding:12px; border-radius:10px; font-size:14px; text-align:left; }
  .bottom-nav .nav-btn.active { background:#dff3ef; }
  .bottom-nav .app-brand { display:block; padding:8px 12px 18px; margin:0; }
  .bottom-nav .app-brand-logo { width:190px; max-width:100%; }
  .nav-section-label { display:block; }
  .sc-responsive-scrim { position:fixed; inset:var(--sc-toolbar-height,60px) 0 0; z-index:9998; border:0; background:#10201d80; border-radius:0; width:100%; }
  .sc-responsive-scrim[hidden] { display:none; }
  body.sc-navigation-open { overflow:hidden; }
  .sc-responsive-grid { grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))!important; }
  .sc-responsive-grid>.wide { grid-column:1/-1; }
}
@media screen and (max-width:600px) {
  body .app main { padding:12px; }
  body .top { padding:16px 12px; }
  .private-online-toolbar { padding:8px 10px; flex-wrap:wrap; gap:8px; }
  .private-online-toolbar>div:first-child { flex:1 1 100%; font-size:12px; }
  .private-online-actions { width:100%; flex-direction:row; gap:6px; align-items:center; }
  .private-online-actions button { min-height:40px; padding:8px 10px; }
  .private-local-warning { padding:8px 12px; font-size:11px; }
  .pgpro-element-header { grid-template-columns:52px minmax(0,1fr)!important; gap:12px; }
  .pgpro-element-header .pgpro-back { grid-column:1/-1; justify-self:start; }
  .toprow { flex-direction:column; align-items:flex-start; gap:10px; }
  .top-project-branding { max-width:100%; width:100%; }
  .top-project-indicator { text-align:left; }
  .top h1 { font-size:22px; }
  .top p { font-size:13px; }
  .desktop-section-context { max-width:100%; }
  :where(.section-title,[class$='-heading']) { align-items:flex-start; }
  :where(.card,.form-card,[class$='-panel'],[class$='-card']) { padding:14px; }
  :where(.form-grid,.collaborator-form-grid,.collaborator-emergency-fields,.collaborator-detail-grid,.collaborator-detail-layout,.settings-project-grid,.settings-work-catalog-grid,.private-catalog-grid) { grid-template-columns:minmax(0,1fr)!important; }
  .sc-responsive-grid { grid-template-columns:minmax(0,1fr)!important; }
  .sc-responsive-grid>* { grid-column:auto!important; }
  .cards { grid-template-columns:minmax(0,1fr); }
  :where(.collaborator-filters,[class$='-filters'],[class$='-filter-bar']) { display:flex; flex-wrap:wrap; align-items:stretch; }
  :where(.collaborator-filters,[class$='-filters'],[class$='-filter-bar'])>label { flex:1 1 100%; min-width:0; }
  input,select,textarea { font-size:16px!important; } /* Prevent automatic iOS focus zoom; allow manual pinch zoom. */
  :where(button,.sc-button,.sc-create-primary) { min-height:40px; }
  dialog { width:calc(100vw - 16px)!important; max-width:calc(100vw - 16px)!important; max-height:calc(100dvh - 16px)!important; margin:auto; border-radius:14px; }
  dialog :where(.modal,[class$='-inner']) { padding:16px; }
  dialog :where(.modal-actions,[class$='-footer']) { position:static; gap:8px; }
  .settings-letterhead-preview { grid-template-columns:minmax(0,1fr); }
  .settings-letterhead-preview>span { height:70px; }
  .settings-logo-drop { flex-direction:column; align-items:stretch; }
  #settings .settings-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  #settings .settings-tabs button { padding:10px 6px; font-size:13px; }
  .private-auth-gate { padding:16px; overflow:auto; }
  .private-auth-card { padding:22px; }
  .private-auth-card h1 { font-size:24px; }
}
@media print {
  .sc-responsive-menu,.sc-responsive-scrim { display:none!important; }
  .sc-responsive-table { display:contents; }
}

