/* Responsive shipment entry layout. Keep controls inside the Flow viewport. */
#shipments {
  min-width: 0;
  overflow: visible;
}

#shipments .head {
  flex-wrap: wrap;
  align-items: center;
}

#shipments .head .actions {
  flex: 1 1 420px;
  justify-content: flex-end;
}

#shipments .body,
#shipments .form,
#shipments .form label {
  min-width: 0;
}

#shipments .form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

#shipments .shipment-form-pattern {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  background: #f7fafb;
}

#shipments .shipment-form-pattern > input[type="hidden"] {
  display: none;
}

#shipments .shipment-form-section {
  grid-column: span 4;
  min-width: 0;
  padding: 14px;
  border: 1px solid #dfe8eb;
  border-radius: 8px;
  background: #fff;
}

#shipments .shipment-form-section--transport {
  grid-column: span 8;
}

#shipments .shipment-form-section--notes {
  grid-column: 1 / -1;
}

#shipments .shipment-form-section__heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e8eef0;
}

#shipments .shipment-form-section__heading h3 {
  margin: 0;
  color: #173942;
  font-size: 13px;
  letter-spacing: .01em;
}

#shipments .shipment-form-section__heading p {
  margin: 3px 0 0;
  color: #73858c;
  font-size: 11px;
  font-weight: 500;
}

#shipments .shipment-form-section__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#shipments .shipment-form-section--transport .shipment-form-section__fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#shipments .shipment-form-section--notes .shipment-form-section__fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#shipments .shipment-form-section--notes label {
  min-height: 92px;
}

#shipments .form input,
#shipments .form select,
#shipments .form textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#shipments .form textarea {
  resize: vertical;
}

#shipments .scroll {
  max-width: 100%;
  overflow-x: auto;
}

#shipments .scroll table {
  min-width: 760px;
}

.calendarToolbar .actions {
  align-items: end;
}

.calendarSearchField {
  min-width: min(300px, 100%);
}

.calendarHint {
  margin: 10px 0 0;
  color: #73858c;
  font-size: 12px;
}

#shipmentCalendar .calItem {
  display: grid;
  gap: 2px;
  text-align: left;
  min-width: 0;
}

#shipmentCalendar .calItem span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flowSettingsIntro p {
  margin: 0;
  color: #607080;
}

.flowSettingsMasters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.flowSettingsMaster {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #dfe8eb;
  border-radius: 8px;
  background: #fff;
}

.flowSettingsMaster h3 {
  margin: 4px 0;
  color: #173942;
  font-size: 16px;
}

.flowSettingsMaster p {
  margin: 0;
  color: #73858c;
  font-size: 12px;
}

.flowSettingsEyebrow {
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.flowSettingsLinks h3 {
  margin: 0 0 12px;
}

.flowSettingsSteps {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.flowSettingsSteps button {
  border: 1px solid #cfe1df;
  border-radius: 999px;
  padding: 8px 12px;
  background: #f3faf8;
  color: #0f514b;
  cursor: pointer;
  font-weight: 800;
}

.flowSettingsSteps button:hover {
  background: #e2f4ef;
}

.flowSettingsSteps span {
  color: #8aa0a5;
  font-weight: 800;
}

.flowNavExpand {
  margin: 4px 0;
}

.flowNavExpand summary {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #d7e1e8;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.flowNavExpand summary::-webkit-details-marker {
  display: none;
}

.flowNavExpand summary::after {
  content: '+';
  color: #9fb4ba;
  font-size: 16px;
}

.flowNavExpand[open] summary::after {
  content: '-';
}

.flowNavExpand summary b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border: 1px solid #3a4855;
  border-radius: 6px;
  background: #18232d;
  color: #c6d4dd;
  font-size: 10px;
}

.flowNavExpand summary:hover,
.flowNavExpand[open] summary {
  border-color: #475868;
  background: #2b3844;
  color: #fff;
}

.flowNavExpand > .navItem {
  margin-left: 12px;
}

.workflowMasterAccess {
  background: #fbfdfd;
}

.workflowMasterAccess__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.workflowMasterAccess__head h3 {
  margin: 4px 0;
  color: #173942;
}

.workflowMasterAccess__head p {
  margin: 0;
  color: #73858c;
  font-size: 12px;
}

.workflowMasterAccess__hint {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}

.workflowMasterAccess__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.workflowMasterCard {
  min-width: 0;
  border: 1px solid #dfe8eb;
  border-radius: 8px;
  background: #fff;
}

.workflowMasterCard summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.workflowMasterCard summary::-webkit-details-marker {
  display: none;
}

.workflowMasterCard summary b,
.workflowMasterCard summary small {
  display: block;
}

.workflowMasterCard summary b {
  color: #173942;
}

.workflowMasterCard summary small {
  margin-top: 4px;
  color: #73858c;
  font-size: 11px;
}

.workflowMasterCard summary strong {
  color: #0f766e;
  font-size: 18px;
}

.workflowMasterCard > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 14px 14px;
  border-top: 1px solid #edf2f3;
}

/* Shared Flow layout rules. These keep every form inside the viewport, not
   only the shipment form, while preserving the denser desktop workspace. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

main,
.section,
.body,
.head,
.form,
.form label,
.actions,
.userbar,
.reportHero,
.reportFilters,
.reportPreview {
  min-width: 0;
}

.form input,
.form select,
.form textarea,
.actions input,
.actions select,
.actions textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.form textarea {
  resize: vertical;
}

.head .actions,
.reportHero .reportActions,
.previewHead .actions {
  flex-wrap: wrap;
}

.scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

button,
.btn,
select,
input[type="date"],
input[type="file"] {
  min-height: 40px;
}

@media (max-width: 1100px) {
  main {
    padding: 14px;
  }

  .form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reportFilters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  main {
    padding: 12px;
  }

  .form,
  .reportFilters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .head,
  .reportHero,
  .previewHead,
  .userbar {
    align-items: stretch;
    flex-direction: column;
  }

  .head .actions,
  .reportHero .reportActions,
  .previewHead .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .head .actions .btn,
  .reportHero .reportActions .btn,
  .previewHead .actions .btn {
    flex: 1 1 150px;
  }

  .docBox {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }
}

@media (max-width: 560px) {
  main {
    padding: 8px;
  }

  .form,
  .reportFilters,
  .reportRelated,
  .reportCatalog {
    grid-template-columns: 1fr;
  }

  .section {
    margin-bottom: 10px;
  }

  .head,
  .body,
  .reportHero,
  .reportFilters,
  .reportPreview {
    padding: 12px;
  }

  .head .actions,
  .reportHero .reportActions,
  .previewHead .actions,
  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .head .actions > *,
  .reportHero .reportActions > *,
  .previewHead .actions > *,
  .actions > * {
    width: 100%;
    min-width: 0;
  }

  .form .wide,
  .wide {
    grid-column: auto;
  }

  .scroll table {
    min-width: 680px;
  }

  .calendarGrid {
    grid-template-columns: 1fr;
  }

  .calHead {
    display: none;
  }

  .calDay {
    min-height: auto;
  }

  .docBox {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 8px;
  }

  .docHead,
  .docActions {
    flex-wrap: wrap;
  }

  .docActions .btn {
    flex: 1 1 110px;
  }
}

@media (max-width: 1100px) {
  #shipments .form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  #shipments .head .actions {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  #shipments .form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #shipments .shipment-form-pattern {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #shipments .shipment-form-section,
  #shipments .shipment-form-section--transport {
    grid-column: span 1;
  }

  #shipments .shipment-form-section--notes {
    grid-column: 1 / -1;
  }

  #shipments .btn {
    min-height: 40px;
  }

  .flowSettingsMasters {
    grid-template-columns: 1fr;
  }

  .flowSettingsMaster {
    align-items: stretch;
    flex-direction: column;
  }

  .workflowMasterAccess__grid {
    grid-template-columns: 1fr;
  }

  .workflowMasterAccess__head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  #shipments .body {
    padding: 12px;
  }

  #shipments .form {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #shipments .shipment-form-pattern {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #shipments .shipment-form-section,
  #shipments .shipment-form-section--transport,
  #shipments .shipment-form-section--notes {
    grid-column: auto;
    padding: 12px;
  }

  #shipments .shipment-form-section__fields,
  #shipments .shipment-form-section--transport .shipment-form-section__fields,
  #shipments .shipment-form-section--notes .shipment-form-section__fields {
    grid-template-columns: 1fr;
  }

  #shipments .form .wide {
    grid-column: auto;
  }

  #shipments .head {
    padding: 12px;
  }

  #shipments .head .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #shipments .head .actions .btn {
    width: 100%;
    min-width: 0;
  }

  #shipments .actions input,
  #shipments .actions select {
    width: 100%;
    min-width: 0;
  }

  #shipments .scroll table {
    min-width: 680px;
  }

  .calendarSearchField {
    min-width: 0;
    width: 100%;
  }
}
