/**
 * Documentos - régua pública canônica.
 * Rotas: /documentos/, /documentos/?negocio=..., /documentos/?negocio=...&setor=...
 * e leitores web /documentos/{slug}/.
 *
 * O Frontend Shell já estabelece a régua do Header. Este arquivo impede que
 * containers internos do módulo descontem uma segunda margem. Ele não altera
 * templates de card, conteúdo, acesso, filtros, banco ou regras de negócio.
 */

/* Desktop e tablet largo: mesma fórmula do Header Portal, aplicada uma única
 * vez ao container externo de cada superfície de Documentos. */
body.cc-shell--portal .conecta-app.cc-documents-page > .cc-documents-directory,
body.cc-shell--reader .conecta-app.cc-documents-page > .cc-documents-directory,
body.cc-shell--portal .conecta-app.cc-documents-reader > .conecta-web-document-layout,
body.cc-shell--reader .conecta-app.cc-documents-reader > .conecta-web-document-layout {
  width: min(var(--cc-shell-page-max), calc(100% - (var(--cc-shell-page-gutter) * 2))) !important;
  max-width: var(--cc-shell-page-max) !important;
  min-width: 0 !important;
  margin: 0 auto var(--cc-shell-section-gap, 48px) !important;
  box-sizing: border-box !important;
}

/* Directory grids and the sector result shell consume the outer ruler; they
 * must never calculate a second viewport/page gutter from inside it. */
body.cc-shell--portal .conecta-app.cc-documents-page > .cc-documents-directory > .conecta-docs-grid,
body.cc-shell--reader .conecta-app.cc-documents-page > .cc-documents-directory > .conecta-docs-grid,
body.cc-shell--portal .conecta-app.cc-documents-page > .cc-documents-directory > .conecta-doc-list-shell,
body.cc-shell--reader .conecta-app.cc-documents-page > .cc-documents-directory > .conecta-doc-list-shell {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}

/* The protected web reader is a primary page surface, not a narrow card inside
 * a second canvas. Its internal content keeps its own editorial column. */
body.cc-shell--portal .conecta-app.cc-documents-reader > .conecta-web-document-layout > .conecta-web-document,
body.cc-shell--reader .conecta-app.cc-documents-reader > .conecta-web-document-layout > .conecta-web-document {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

@media (max-width: 860px) {
  /* The Portal Header changes to width: 100% in the app frame below 860px.
   * Documentos follows exactly that contract; no viewport calculation here. */
  body.cc-shell--portal .conecta-app.cc-documents-page > .cc-documents-directory,
  body.cc-shell--reader .conecta-app.cc-documents-page > .cc-documents-directory,
  body.cc-shell--portal .conecta-app.cc-documents-reader > .conecta-web-document-layout,
  body.cc-shell--reader .conecta-app.cc-documents-reader > .conecta-web-document-layout {
    width: 100% !important;
    max-width: none !important;
    margin-bottom: 40px !important;
  }
}
