/* r131: one final responsive layer for browser zoom and narrow viewports. */
body.customer-portal #customer,
body.customer-portal #customer .portal-tab-view,
body.customer-portal #customer .portal-tab-view > *,
body.customer-portal #customer :is(.customer-product-inline-search,.customer-submit-layout,.customer-project-layout,.customer-railway-filter,.customer-railway-management,.customer-railway-management-controls,.customer-railway-management-toolbar) {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Enterprise profile dialog. */
body.customer-portal #customerProfileModal.modal {
  position: fixed !important;
  z-index: 5000 !important;
  inset: 0 !important;
  display: grid !important;
  width: 100vw !important;
  height: 100dvh !important;
  place-items: center !important;
  padding: 22px !important;
  overflow: hidden !important;
  background: rgba(22,34,53,.54) !important;
  backdrop-filter: blur(5px);
}
body.customer-portal #customerProfileModal.modal.hidden { display: none !important; }
body.customer-portal #customerProfileModal .customer-profile-panel {
  display: grid !important;
  width: min(980px,calc(100vw - 44px)) !important;
  max-width: 980px !important;
  height: auto !important;
  max-height: calc(100dvh - 44px) !important;
  grid-template-rows: auto minmax(0,1fr) !important;
  overflow: hidden !important;
  border: 1px solid #d8e2ef !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 28px 80px rgba(16,35,62,.28) !important;
}
body.customer-portal #customerProfileModal .customer-profile-head {
  display: flex !important;
  min-height: 78px !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 18px 14px 22px !important;
  border-bottom: 1px solid #e2e8f1 !important;
  background: linear-gradient(135deg,#f8fbff 0,#eef7f6 100%) !important;
}
body.customer-portal #customerProfileModal .customer-profile-heading { display: flex; align-items: center; gap: 13px; min-width: 0; }
body.customer-portal #customerProfileModal .customer-profile-heading > div { display: grid; min-width: 0; gap: 3px; }
body.customer-portal #customerProfileModal .customer-profile-heading strong { color: #19304d; font-size: 20px; }
body.customer-portal #customerProfileModal .customer-profile-heading small { color: #708198; font-size: 12px; }
body.customer-portal #customerProfileModal .customer-profile-mark {
  display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center;
  border-radius: 13px; color: #fff; background: linear-gradient(135deg,#2563df,#07998f);
  box-shadow: 0 8px 18px rgba(37,99,223,.22); font-size: 20px; font-weight: 900;
}
body.customer-portal #customerProfileModal .customer-profile-close {
  display: grid !important; flex: 0 0 38px !important; width: 38px !important; height: 38px !important;
  min-width: 38px !important; min-height: 38px !important; place-items: center !important; padding: 0 !important;
  border: 1px solid #d5deea !important; border-radius: 10px !important; color: #697990 !important;
  background: #fff !important; box-shadow: 0 3px 9px rgba(31,52,81,.07) !important; font-size: 25px !important;
}
body.customer-portal #customerProfileModal .customer-profile-form {
  display: grid !important;
  gap: 14px !important;
  min-height: 0 !important;
  padding: 18px 20px 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  background: #f7f9fc !important;
}
body.customer-portal #customerProfileModal .customer-profile-section {
  display: grid; gap: 14px; padding: 16px; border: 1px solid #dfe6f0; border-radius: 13px; background: #fff;
}
body.customer-portal #customerProfileModal .customer-profile-section-title { display: flex; align-items: baseline; gap: 10px; }
body.customer-portal #customerProfileModal .customer-profile-section-title strong { color: #263a56; font-size: 15px; }
body.customer-portal #customerProfileModal .customer-profile-section-title span { color: #8a97a9; font-size: 11px; }
body.customer-portal #customerProfileModal .customer-profile-readonly {
  display: grid !important; grid-template-columns: 2fr 1fr 1fr 1fr !important; gap: 10px !important;
}
body.customer-portal #customerProfileModal :is(.customer-profile-readonly,.customer-profile-fields) label {
  display: grid !important; min-width: 0 !important; gap: 7px !important; color: #526078 !important; font-size: 12px !important; font-weight: 750 !important;
}
body.customer-portal #customerProfileModal input:not([type=file]) {
  width: 100% !important; min-width: 0 !important; height: 42px !important; padding: 0 12px !important;
  border: 1px solid #cdd8e6 !important; border-radius: 9px !important; color: #24344d !important; background: #fff !important;
}
body.customer-portal #customerProfileModal input[readonly] { color: #66758b !important; background: #f3f6fa !important; }
body.customer-portal #customerProfileModal .customer-profile-fields {
  display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 14px 16px !important;
}
body.customer-portal #customerProfileModal .customer-profile-wide { grid-column: 1/-1 !important; }
body.customer-portal #customerProfileModal .customer-profile-license { grid-row: span 2; }
body.customer-portal #customerProfileModal .customer-profile-upload {
  position: relative; display: grid; min-height: 82px; place-content: center; justify-items: center; gap: 5px;
  padding: 12px; overflow: hidden; border: 1px dashed #91acd2; border-radius: 10px; color: #315fd8; background: #f4f8ff;
}
body.customer-portal #customerProfileModal .customer-profile-upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
body.customer-portal #customerProfileModal .customer-profile-upload b { font-size: 13px; }
body.customer-portal #customerProfileModal .customer-profile-upload small { color: #8997aa; font-size: 10px; font-weight: 500; }
body.customer-portal #customerProfileModal .customer-profile-license em { color: #16805e; font-size: 11px; font-style: normal; font-weight: 650; }
body.customer-portal #customerProfileModal .customer-profile-actions {
  position: sticky; bottom: 0; display: flex !important; min-height: 68px; align-items: center; justify-content: flex-end;
  gap: 14px; margin: 0 -20px; padding: 12px 20px; border-top: 1px solid #e1e7f0; background: rgba(255,255,255,.96);
}
body.customer-portal #customerProfileModal .customer-profile-error { flex: 1 1 auto; color: #c23f3f; font-size: 12px; }
body.customer-portal #customerProfileModal #customerProfileSaveBtn {
  width: auto !important; min-width: 150px !important; height: 42px !important; padding: 0 20px !important;
  border: 0 !important; border-radius: 9px !important; color: #fff !important; background: linear-gradient(135deg,#315ee8,#079d93) !important;
  box-shadow: 0 7px 18px rgba(37,99,223,.22) !important; font-weight: 800 !important;
}

@media (max-width: 720px) {
  body.customer-portal #customerProfileModal.modal { padding: 8px !important; }
  body.customer-portal #customerProfileModal .customer-profile-panel { width: calc(100vw - 16px) !important; max-height: calc(100dvh - 16px) !important; border-radius: 14px !important; }
  body.customer-portal #customerProfileModal .customer-profile-head { min-height: 68px !important; padding: 10px 12px !important; }
  body.customer-portal #customerProfileModal .customer-profile-mark { flex-basis: 38px; width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
  body.customer-portal #customerProfileModal .customer-profile-heading strong { font-size: 17px; }
  body.customer-portal #customerProfileModal .customer-profile-heading small { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.customer-portal #customerProfileModal .customer-profile-form { padding: 10px 10px 0 !important; gap: 10px !important; }
  body.customer-portal #customerProfileModal .customer-profile-section { padding: 12px; gap: 11px; }
  body.customer-portal #customerProfileModal .customer-profile-section-title { display: grid; gap: 2px; }
  body.customer-portal #customerProfileModal .customer-profile-readonly,
  body.customer-portal #customerProfileModal .customer-profile-fields { grid-template-columns: minmax(0,1fr) !important; }
  body.customer-portal #customerProfileModal .customer-profile-wide { grid-column: 1 !important; }
  body.customer-portal #customerProfileModal .customer-profile-license { grid-row: auto; }
  body.customer-portal #customerProfileModal .customer-profile-actions { margin: 0 -10px; padding: 10px; flex-direction: column; align-items: stretch; }
  body.customer-portal #customerProfileModal #customerProfileSaveBtn { width: 100% !important; }
}

/* Pass cards gained settlement fields after the old 270px desktop row was set. */
body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view #customerRailwayReportCards.customer-railway-report-cards {
  grid-auto-rows: auto !important;
  align-items: start !important;
}
body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view .customer-railway-report-card {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

@media (max-width: 1280px) {
  body.customer-portal #customer #customerProjectsView .customer-project-controls-card,
  body.customer-portal #customer #customerProjectsView .customer-project-record-head {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 10px !important;
  }
  body.customer-portal #customer #customerProjectsView .customer-project-record-head > *,
  body.customer-portal #customer #customerProjectsView #customerProjectStats,
  body.customer-portal #customer #customerProjectsView .customer-project-record-actions {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body.customer-portal #customer #customerProjectsView .customer-project-record-actions {
    display: grid !important;
    grid-template-columns: minmax(220px,1fr) repeat(5,max-content) !important;
    gap: 8px !important;
  }
  body.customer-portal #customer #customerProjectsView #customerProjectKeyword {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-scopes {
    display: grid !important;
    grid-template-columns: repeat(4,minmax(0,1fr)) !important;
    width: 100% !important;
    gap: 8px !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-scopes button {
    width: 100% !important;
    min-width: 0 !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar {
    display: grid !important;
    grid-template-columns: minmax(240px,1.6fr) repeat(3,minmax(120px,1fr)) repeat(3,max-content) !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar > * {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
}

@media (max-width: 1100px) {
  body.customer-portal #customer#customer #customerRailwaySelectedFlow.customer-pass-flow-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-track {
    grid-template-columns: repeat(5,minmax(0,1fr)) !important;
    min-width: 0 !important;
    width: 100% !important;
    row-gap: 22px !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-node:nth-child(5n + 1)::before {
    display: none !important;
  }

  body.customer-portal #customer#customer #customerProductToolbar#customerProductToolbar.customer-product-inline-search {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) 92px 14px 92px !important;
    width: 100% !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerProductToolbar#customerProductToolbar > * { min-width: 0 !important; }

  body.customer-portal #customer #customerSubmitView .customer-submit-layout {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    width: 100% !important;
    gap: 12px !important;
    overflow: visible !important;
  }
  body.customer-portal #customer #customerSubmitView :is(.customer-submit-form,.customer-submit-records) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body.customer-portal #customer#customer #customerSubmitView#customerSubmitView .customer-submit-form {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    height: auto !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerSubmitView#customerSubmitView .customer-submit-form > :is(h3,.customer-submit-form-body) {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  body.customer-portal #customer#customer #customerSubmitView#customerSubmitView .customer-submit-form-body {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    overflow: visible !important;
  }

  body.customer-portal #customer #customerProjectsView .customer-project-record-actions {
    grid-template-columns: minmax(220px,1fr) repeat(3,minmax(90px,auto)) !important;
  }
  body.customer-portal #customer #customerProjectsView :is(#openCustomerProjectInviteBtn,#refreshCustomerProjectsBtn) {
    grid-row: 2 !important;
  }

  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main {
    display: grid !important;
    grid-template-columns: minmax(220px,1fr) repeat(2,minmax(150px,1fr)) !important;
    width: 100% !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main > * {
    grid-row: auto !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main .customer-railway-range {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar {
    grid-template-columns: minmax(220px,2fr) repeat(3,minmax(120px,1fr)) !important;
  }
  body.customer-portal #customer #customerRailwayManagementView :is(#customerRailwayReportSearchBtn,#customerRailwayReportRefreshBtn,.customer-railway-view-switch) {
    grid-row: 2 !important;
    width: auto !important;
  }
}

@media (max-width: 900px) {
  body.customer-portal #customer#customer #customerProductToolbar#customerProductToolbar.customer-product-inline-search {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  body.customer-portal #customer #customerProductKeyword { grid-column: 1/-1 !important; }
  body.customer-portal #customer .customer-product-price-separator { display: none !important; }

  body.customer-portal #customer #customerProjectsView .customer-project-record-actions {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  body.customer-portal #customer #customerProjectsView #customerProjectKeyword { grid-column: 1/-1 !important; }
  body.customer-portal #customer #customerProjectsView :is(#openCustomerProjectInviteBtn,#refreshCustomerProjectsBtn) { grid-row: auto !important; }

  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  body.customer-portal #customer #customerRailwayProductsView #customerRailwayKeyword { grid-column: 1/-1 !important; }

  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-scopes,
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  body.customer-portal #customer #customerRailwayManagementView #customerRailwayReportKeyword { grid-column: 1/-1 !important; }
  body.customer-portal #customer #customerRailwayManagementView :is(#customerRailwayReportSearchBtn,#customerRailwayReportRefreshBtn,.customer-railway-view-switch) {
    grid-row: auto !important;
    width: 100% !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-controls {
    overflow: visible !important;
  }

  /* Pass flow: show every node without a clipped horizontal strip. */
  body.customer-portal #customer#customer #customerRailwaySelectedFlow.customer-pass-flow-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-track {
    grid-template-columns: repeat(5,minmax(0,1fr)) !important;
    min-width: 0 !important;
    width: 100% !important;
    row-gap: 22px !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-node:nth-child(5n + 1)::before {
    display: none !important;
  }

  /* Pass cards: content determines height; no fixed desktop row clipping. */
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view .customer-railway-management-results,
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view #customerRailwayReportCards.customer-railway-report-cards {
    display: block !important;
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view #customerRailwayReportCards.customer-railway-report-cards {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    grid-auto-rows: auto !important;
    align-items: start !important;
    width: 100% !important;
  }
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView .customer-railway-management {
    display: block !important;
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView #customerRailwayManagementPager {
    position: static !important;
    flex: none !important;
  }
  body.customer-portal #customer#customer #customerRailwayManagementView#customerRailwayManagementView.is-card-view .customer-railway-report-card {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 720px) {
  body.customer-portal #customer:not(.portal-locked) {
    padding-left: 0 !important;
  }
  body.customer-portal #customer#customer #customerWorkbenchMobileOpen#customerWorkbenchMobileOpen.customer-workbench-mobile-open {
    position: fixed !important;
    z-index: 110 !important;
    left: max(10px,env(safe-area-inset-left,0px)) !important;
    bottom: max(12px,env(safe-area-inset-bottom,0px)) !important;
    display: inline-flex !important;
    width: 110px !important;
    max-width: 110px !important;
    min-width: 94px !important;
    height: 44px !important;
    min-height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    padding: 0 14px !important;
    visibility: visible !important;
  }
  body.customer-portal #customer#customer > .customer-portal-tabs-row.customer-portal-tabs-row {
    z-index: 120 !important;
    display: flex !important;
    width: min(300px,86vw) !important;
    min-width: min(300px,86vw) !important;
    transform: translateX(-105%) !important;
    transition: transform 180ms ease !important;
  }
  body.customer-portal #customer#customer.workbench-mobile-open > .customer-portal-tabs-row.customer-portal-tabs-row {
    transform: translateX(0) !important;
  }
  body.customer-portal #customer#customer.workbench-mobile-open > .customer-workbench-backdrop.customer-workbench-backdrop {
    position: fixed !important;
    z-index: 115 !important;
    inset: 0 !important;
    display: block !important;
    width: 100vw !important;
    height: 100dvh !important;
    border: 0 !important;
    background: rgba(18,32,52,.42) !important;
  }
  body.customer-portal #customer .customer-portal-tabs-row .portal-tab {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
  }
  body.customer-portal #customer .customer-portal-tabs-row .portal-tab span { display: inline !important; }

  body.customer-portal #customer #customerProductToolbar.customer-product-inline-search,
  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main,
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-scopes,
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar,
  body.customer-portal #customer #customerProjectsView .customer-project-record-actions {
    grid-template-columns: minmax(0,1fr) !important;
  }
  body.customer-portal #customer #customerProductToolbar > *,
  body.customer-portal #customer #customerRailwayProductsView .customer-railway-filter-main > *,
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-toolbar > *,
  body.customer-portal #customer #customerProjectsView .customer-project-record-actions > * {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.customer-portal #customer #customerRailwayManagementView .customer-railway-management-table-wrap {
    max-width: 100% !important;
    overflow-x: auto !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-track {
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    row-gap: 18px !important;
  }
  body.customer-portal #customer#customer #customerRailwaySelectedFlow .shared-pass-progress-node:nth-child(2n + 1)::before {
    display: none !important;
  }
}
.customer-portal #customer .customer-railway-step-workspace.is-shop-confirm-hidden {
  display: none !important;
}

.customer-portal #customer #customerRailwayStepFileRow:is([hidden], .is-step-upload-hidden) {
  display: none !important;
}

.customer-portal #customer .customer-railway-evidence-card {
  min-width: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.customer-portal #customer .customer-railway-evidence-card > span {
  position: relative !important;
  display: block !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.customer-portal #customer .customer-railway-evidence-card > span > img {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  max-height: 34px !important;
  object-fit: cover !important;
  object-position: center !important;
}

.customer-portal #customer .customer-railway-evidence-card > :is(strong, small) {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
