/* portal-cohesion-v1: shared page layout only; the global header remains untouched. */

/* Shared content frame for both server and client shells. */
.portal-top-navigation .content,
.portal-embedded-app .content {
  min-width: 0;
  box-sizing: border-box;
  color: #173b58;
}

.portal-top-navigation .content > .page-head,
.portal-top-navigation .content > .card,
.portal-top-navigation .content > .grid,
.portal-top-navigation .content > .filters,
.portal-top-navigation .content > section,
.portal-top-navigation .content > form,
.portal-embedded-app .content > .page-head,
.portal-embedded-app .content > .card,
.portal-embedded-app .content > .grid,
.portal-embedded-app .content > .filters,
.portal-embedded-app .content > section,
.portal-embedded-app .content > form {
  width: 100%;
  max-width: 1480px;
  min-width: 0;
  margin-inline: auto;
  box-sizing: border-box;
}

.portal-top-navigation .content > .page-head,
.portal-embedded-app .content > .page-head {
  padding-inline: clamp(2px, 0.8vw, 12px);
}

.portal-top-navigation .page-head h1,
.portal-embedded-app .page-head h1,
.portal-top-navigation .card h1,
.portal-embedded-app .card h1,
.portal-top-navigation .card h2,
.portal-embedded-app .card h2,
.portal-top-navigation .card h3,
.portal-embedded-app .card h3 {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.portal-top-navigation .card,
.portal-embedded-app .card,
.portal-top-navigation .filters,
.portal-embedded-app .filters {
  min-width: 0;
  box-sizing: border-box;
}

.portal-top-navigation .grid > *,
.portal-embedded-app .grid > *,
.portal-top-navigation .record-layout > *,
.portal-embedded-app .record-layout > *,
.portal-top-navigation .judgment-record-layout > *,
.portal-embedded-app .judgment-record-layout > *,
.portal-top-navigation .sector-layout > *,
.portal-embedded-app .sector-layout > *,
.portal-top-navigation .sanctions-workspace > *,
.portal-embedded-app .sanctions-workspace > * {
  min-width: 0;
}

/* Every local rail stays in normal document flow. */
.portal-top-navigation .module-workspace,
.portal-embedded-app .module-workspace,
.portal-top-navigation .module-rail,
.portal-embedded-app .module-rail,
.portal-top-navigation .sejm-workspace,
.portal-embedded-app .sejm-workspace,
.portal-top-navigation .sejm-rail,
.portal-embedded-app .sejm-rail {
  position: static;
  box-sizing: border-box;
}

.portal-top-navigation .module-workspace,
.portal-embedded-app .module-workspace,
.portal-top-navigation .sejm-workspace,
.portal-embedded-app .sejm-workspace {
  width: 100%;
  max-width: 1480px;
  margin-inline: auto;
  min-width: 0;
}

/* Keep the named sections visually recognizable across all requested departments. */
body[data-page="judgment"] .module-canvas,
body[data-page="laws"] .module-canvas,
body[data-page="law"] .module-canvas,
body[data-page="sejm"] .sejm-canvas,
body[data-page="sejm-record"] .sejm-canvas,
body[data-page="registers"] .module-canvas,
body[data-page="krz"] .module-canvas,
body[data-page="lawyers"] .module-canvas,
body[data-page="registry-record"] .module-canvas {
  min-width: 0;
}

body[data-page="judgment"] .judgment-record-tabs,
body[data-page="laws"] .tabs,
body[data-page="law"] .tabs,
body[data-page="sejm"] .tabs,
body[data-page="sejm-record"] .tabs,
body[data-page="registers"] .tabs,
body[data-page="krz"] .tabs,
body[data-page="lawyers"] .tabs {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

body[data-page="judgment"] .module-rail > nav a,
body[data-page="judgment"] .module-rail > nav button,
body[data-page="laws"] .module-rail > nav a,
body[data-page="law"] .module-rail > nav a,
body[data-page="sejm-record"] .module-rail > nav a,
body[data-page="registers"] .module-rail > nav a,
body[data-page="krz"] .module-rail > nav a,
body[data-page="lawyers"] .module-rail > nav a {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .portal-top-navigation .content,
  .portal-embedded-app .content {
    padding-inline: 12px;
  }

  .portal-top-navigation .content > .page-head,
  .portal-embedded-app .content > .page-head {
    padding-inline: 0;
  }

  .portal-top-navigation .grid.two,
  .portal-embedded-app .grid.two,
  .portal-top-navigation .judgment-record-layout,
  .portal-embedded-app .judgment-record-layout,
  .portal-top-navigation .sector-layout,
  .portal-embedded-app .sector-layout,
  .portal-top-navigation .sanctions-workspace,
  .portal-embedded-app .sanctions-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-top-navigation .card,
  .portal-embedded-app .card {
    border-radius: 18px;
  }
}

@media (max-width: 560px) {
  .portal-top-navigation .content,
  .portal-embedded-app .content {
    padding-inline: 8px;
  }

  .portal-top-navigation .content > .card,
  .portal-top-navigation .content > .grid,
  .portal-top-navigation .content > .filters,
  .portal-top-navigation .content > section,
  .portal-top-navigation .content > form,
  .portal-embedded-app .content > .card,
  .portal-embedded-app .content > .grid,
  .portal-embedded-app .content > .filters,
  .portal-embedded-app .content > section,
  .portal-embedded-app .content > form {
    max-width: 100%;
  }

  .portal-top-navigation .card,
  .portal-embedded-app .card {
    border-radius: 15px;
  }
}

/* Na telefonie widok wyroku zawija elementy zamiast tworzyć poziomy scroll. */
@media (max-width: 820px) {
  body[data-page="judgment"] .module-canvas-scroll,
  body[data-page="judgment"] .judgment-module-rail,
  body[data-page="judgment"] .judgment-record-tabs,
  body[data-page="judgment"] .judgment-record-actions {
    max-width: 100%;
    overflow-x: hidden !important;
  }

  body[data-page="judgment"] .judgment-record-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body[data-page="judgment"] .judgment-record-tabs button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    white-space: normal;
    text-align: left;
    line-height: 1.25;
  }

  body[data-page="judgment"] .judgment-record-actions {
    flex-wrap: wrap !important;
  }

  body[data-page="judgment"] .judgment-record-actions .btn {
    min-width: 0 !important;
    flex: 1 1 140px !important;
  }
}
