/* Scoped to the alerts modal; other application dialogs are unaffected. */
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog {
  width: min(940px, calc(100vw - 24px)) !important;
  max-width: min(940px, calc(100vw - 24px)) !important;
  height: min(900px, calc(100vh - 40px)) !important;
  height: min(900px, calc(100dvh - 40px)) !important;
  max-height: none !important;
  margin: 20px auto;
}
#generic-modal-alerts .modal-content {
  height: min(900px, calc(100vh - 40px)) !important;
  height: min(900px, calc(100dvh - 40px)) !important;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dbe5df;
  border-radius: 16px;
  box-shadow: 0 24px 70px #183d3029;
}
#generic-modal-alerts .modal-header {
  background: #f0f6f3;
  border-bottom: 1px solid #dce7e0;
  background: #b9c9da;
  border-bottom: 1px solid #8fa2cc;
  padding: 16px 24px;
  color: #234b39;
  color: var(--bs-body-color, #212529);
}
#generic-modal-alerts .modal-footer {
  background: #f8faf9;
  border-top: 1px solid #dce7e0;
  background: #e9ecee;
  border-top: 1px solid #8fa2cc;
  padding: 14px 24px;
  gap: 8px;
}
#generic-modal-alerts .modal-footer .btn {
  min-width: 100px;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 600;
  margin: 0;
}
#generic-modal-cancel-btn-alerts {
  background: white;
  color: #47564d;
  border-color: #ccd8d0;
}
#generic-modal-alerts .modal-body {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
/* Size only the loader's ancestor chain, never its spinner elements. */
#generic-modal-alerts .modal-body div:has(#generic-modal-body-alerts),
#generic-modal-body-alerts {
  height: 100%;
  min-height: 0;
}
#generic-modal-alerts .alerts-modal-layout,
#generic-modal-alerts .alerts-modal-layout > div {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#generic-modal-alerts .nav-tabs {
  flex: 0 0 auto;
  padding: 12px 24px 0;
  gap: 6px;
  border-bottom: 1px solid #e2e9e5;
}
#generic-modal-alerts .nav-tabs .nav-link {
  padding: 12px 18px;
  color: #64746b;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
}
#generic-modal-alerts .nav-tabs .nav-link.active {
  color: #197344;
  background: #f2f8f4;
  border-color: #dce7e0 #dce7e0 transparent;
}
#generic-modal-alerts .tab-content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}
#generic-modal-alerts .tab-pane {
  height: 100%;
  min-height: 0;
}
#generic-modal-alerts .alerts-config-panel {
  height: 100%;
  padding: 20px 24px;
  min-height: 0;
}
#generic-modal-alerts .alerts-config-table {
  height: 100%;
  overflow: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  border: 1px solid #dfe7e2;
  border-radius: 10px;
  background: white;
  scrollbar-width: thin;
  scrollbar-color: #b9cec0 #f5f8f6;
}
#generic-modal-alerts .alerts-config-header,
#generic-modal-alerts .alerts-config-row {
  display: grid;
  grid-template-columns: 44px minmax(180px, 1.2fr) minmax(125px, .75fr) minmax(210px, 1.4fr);
  min-width: 600px;
  margin: 0;
  gap: 12px;
  padding: 12px 16px;
}
#generic-modal-alerts .alerts-config-header > *,
#generic-modal-alerts .alerts-config-row > * {
  width: auto;
  min-width: 0;
  padding: 0;
}
#generic-modal-alerts .alerts-config-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #edf4ef;
  color: #476052;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid #d7e3da;
}
#generic-modal-alerts .alerts-config-row {
  min-height: 64px;
  border-bottom: 1px solid #edf1ee;
  font-size: 13px;
}
#generic-modal-alerts .alerts-config-row:last-child { border-bottom: 0; }
#generic-modal-alerts .alerts-config-row:hover { background: #f7faf8; }
#generic-modal-alerts .alerts-config-row:has(input:checked) { background: #f0f8f3; }
#generic-modal-alerts .alerts-config-row:focus-within { background: #f3f8f5; }
#generic-modal-alerts .alerts-config-row:has(input:checked) {
  background: var(--sg-primary-light, #e8f2fc);
  box-shadow: inset 3px 0 0 var(--sg-primary, #177da5);
}
#generic-modal-alerts .alerts-config-row .form-control {
  min-height: 38px;
  border-radius: 7px;
  border-color: #d7e1db;
}
#generic-modal-alerts .alerts-select { margin: 0; }
#generic-modal-alerts .alerts-select .form-check-input {
  width: 17px;
  height: 17px;
  cursor: pointer;
}
/* Preserve an accessible checkbox name without repeating the visible alert name. */
#generic-modal-alerts .alerts-select label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#generic-modal-alerts .Select-control { border-radius: 7px; border-color: #d7e1db; }
#generic-modal-alerts .Select-menu-outer { z-index: 4; }
/* Leave room to open the final row's notification menu inside the scroller. */
#generic-modal-alerts #alert-types-list:has(.is-open) { padding-bottom: 220px; }
#generic-modal-alerts .alerts-timeline-scroll {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
#generic-modal-alerts :is(input, button, a, [tabindex]):focus-visible {
  outline: 2px solid #238752;
  outline-offset: 3px;
}
/* Bound the tab viewport directly to the modal body. Dash Tabs/Loading
   wrappers must not determine the scroll area's height from its contents. */
#generic-modal-alerts .modal-body { position: relative; }
#generic-modal-alerts .modal-body div:has(#generic-modal-body-alerts),
#generic-modal-body-alerts,
#generic-modal-alerts .alerts-modal-layout,
#generic-modal-alerts .alerts-modal-layout > div {
  position: static !important;
}
#generic-modal-alerts .nav-tabs {
  height: 64px;
  box-sizing: border-box;
  flex-wrap: nowrap;
}
#generic-modal-alerts .tab-content {
  position: absolute;
  inset: 64px 0 0;
  height: auto;
  min-height: 0;
  overflow: hidden;
}
#generic-modal-alerts .tab-pane {
  position: relative;
  height: 100%;
}
#generic-modal-alerts .alerts-config-panel {
  position: absolute;
  inset: 0;
  height: auto;
  padding: 0;
}
#generic-modal-alerts .alerts-config-table {
  position: absolute;
  inset: 20px 24px;
  height: auto;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: auto;
}
@media (max-width: 600px) {
  #generic-modal-alerts.modal-dialog,
  #generic-modal-alerts .modal-dialog {
    height: calc(100dvh - 16px) !important;
    margin: 8px auto;
  }
  #generic-modal-alerts .modal-content {
    height: calc(100vh - 16px) !important;
    height: calc(100dvh - 16px) !important;
  }
  #generic-modal-alerts .modal-header,
  #generic-modal-alerts .modal-footer { padding: 12px 16px; }
  #generic-modal-alerts .alerts-config-panel { padding: 12px; }
  #generic-modal-alerts .alerts-config-panel { padding: 0; }
  #generic-modal-alerts .alerts-config-table { inset: 12px; }
  #generic-modal-alerts .nav-tabs { padding-inline: 12px; }
}