/* Global responsive layer (safe overrides, no business logic impact) */

/* Prevent accidental horizontal overflow from fixed-width children */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.container,
.container-fluid,
.card,
.card-body,
.card-header,
.row > [class*="col-"] {
  min-width: 0;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Navbar baseline */
.app-navbar .navbar-brand {
  padding-top: 0;
  padding-bottom: 0;
}

.app-navbar-logo {
  height: 78px;
  width: auto;
}

.app-navbar .navbar-text {
  white-space: normal;
}

/* Reusable helpers for page headers and compact period forms */
.app-page-head {
  gap: 0.5rem;
}

.d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom {
  row-gap: 0.5rem;
}

.app-period-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.app-period-form .app-period-year {
  width: 100px;
}

.app-period-form .app-period-month {
  width: 160px;
}

.app-inline-maxw {
  max-width: 420px;
}

.app-inline-maxw-sm {
  max-width: 320px;
}

@media (max-width: 991.98px) {
  .app-navbar-logo {
    height: 62px;
  }

  .app-navbar .navbar-nav .nav-link {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .app-navbar .navbar-text {
    font-size: 0.9rem;
    line-height: 1.2 !important;
    text-align: left !important;
    margin-right: 0.5rem !important;
  }

  .app-navbar .btn {
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
  }

  .app-page-head .btn-toolbar {
    width: 100%;
  }

  .app-page-head .btn-toolbar > * {
    flex: 1 1 auto;
    min-width: 150px;
  }

  .app-period-form {
    width: 100%;
  }

  .d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom > .d-flex.gap-2,
  .d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom > .btn-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }
}

@media (max-width: 767.98px) {
  .container,
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .container.my-4 {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .app-navbar-logo {
    height: 54px;
  }

  .app-page-head > .d-flex,
  .app-page-head > .btn-toolbar,
  .app-page-head > .app-toolbar-wrap {
    width: 100%;
  }

  .app-page-head .btn-toolbar,
  .app-page-head .app-toolbar-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem !important;
  }

  .app-page-head .btn-toolbar > *,
  .app-page-head .app-toolbar-wrap > * {
    flex: 1 1 100%;
    min-width: 0;
  }

  .app-period-form > div {
    flex: 1 1 100%;
    min-width: 0;
  }

  .app-period-form .app-period-year,
  .app-period-form .app-period-month,
  .app-period-form .form-control,
  .app-period-form .form-select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .app-period-form .btn {
    width: 100%;
  }

  .app-inline-maxw,
  .app-inline-maxw-sm {
    width: 100%;
    max-width: 100%;
  }

  #catalog-section-filter-form {
    width: 100%;
    margin-left: 0 !important;
  }

  #catalog-section-filter-select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .d-flex.justify-content-between.flex-wrap.flex-md-nowrap.align-items-center.pt-3.pb-2.mb-3.border-bottom > *,
  .d-flex.justify-content-between.align-items-center.pt-2.pb-2.mb-3.border-bottom > * {
    width: 100%;
  }

  .d-flex.justify-content-between.align-items-center.pt-2.pb-2.mb-3.border-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .d-flex.justify-content-between.align-items-center.pt-2.pb-2.mb-3.border-bottom .btn {
    width: 100%;
  }

  input[style*="width: 100px"],
  input[style*="width:100px"],
  select[style*="width: 160px"],
  select[style*="width:160px"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  select[style*="min-width: 260px"],
  select[style*="min-width:260px"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  [style*="max-width: 420px"],
  [style*="max-width:420px"],
  [style*="max-width: 320px"],
  [style*="max-width:320px"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  .table-responsive table th[style*="width"],
  .table-responsive table td[style*="width"],
  .table-responsive table th[style*="min-width"],
  .table-responsive table td[style*="min-width"] {
    width: auto !important;
    min-width: 0 !important;
  }

  iframe[style*="height:70vh"],
  iframe[style*="height:72vh"] {
    height: 58vh !important;
  }
}
