/* SensiGrow Alerts: all rules are scoped to the existing modal. */
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog {
  width: min(1240px, calc(100vw - 32px)) !important;
  max-width: min(1240px, calc(100vw - 32px)) !important;
  margin: 4vh auto;
}
#generic-modal-alerts .modal-content {
  height: 88vh;
  height: 88dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #dce5ed;
  border-radius: 18px;
  box-shadow: 0 24px 80px #20354d30;
  background: #f5f8fb;
  color: #24364b;
}
#generic-modal-alerts .modal-header {
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid #e3eaf1;
}
#generic-modal-alerts .modal-title { font-size: 21px; font-weight: 700; }
#generic-modal-alerts .modal-footer {
  background: #fff;
  border-top: 1px solid #e3eaf1;
  padding: 12px 24px;
  gap: 10px;
}
#generic-modal-alerts .modal-footer .btn {
  min-width: 104px;
  min-height: 42px;
  border-radius: 9px;
  font-weight: 600;
  margin: 0;
}
#generic-modal-cancel-btn-alerts { background: #fff; color: #475569; border-color: #ccd8e3; }
#generic-modal-apply-btn-alerts { background: #177da5; border-color: #177da5; color: #fff; }
#generic-modal-apply-btn-alerts:hover { background: #126385; border-color: #126385; }
#generic-modal-alerts .modal-body { position: relative; min-height: 0; padding: 0; overflow: hidden; }
/* Preserve the bounded viewport through generic modal Loading wrappers. */
#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;
  height: 100%;
  min-height: 0;
}
#generic-modal-alerts .nav-tabs {
  height: 62px;
  box-sizing: border-box;
  padding: 10px 24px 0;
  gap: 8px;
  flex-wrap: nowrap;
  background: #fff;
  border-bottom: 1px solid #dfe7ef;
}
#generic-modal-alerts .nav-tabs .nav-link {
  padding: 13px 20px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #64748b;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
}
#generic-modal-alerts .nav-tabs .nav-link.active {
  color: #126e94;
  background: #eef7fb;
  border-bottom-color: #177da5;
}
#generic-modal-alerts .tab-content { position: absolute; inset: 62px 0 0; overflow: hidden; min-height: 0; }
#generic-modal-alerts .tab-pane { position: relative; height: 100%; min-height: 0; }
#generic-modal-alerts .alerts-timeline-scroll {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
/* Keep tall timelines inside the modal viewport; scroll within the plot to
   inspect every plant-unit lane without letting the fixed footer cover it. */
#generic-modal-alerts .alerts-plot-viewport {
  max-height: 560px;
  overflow: auto;
  min-height: 300px;
  scrollbar-gutter: stable;
}
#generic-modal-alerts .alerts-timeline-plot { min-height: 300px; width: 100%; }
#generic-modal-alerts .alerts-dashboard { padding: 22px 24px 28px; display: grid; gap: 18px; }
#generic-modal-alerts .alerts-intro h4 { font-size: 20px; font-weight: 700; margin: 0 0 5px; }
#generic-modal-alerts .alerts-intro p,
#generic-modal-alerts .alerts-section-heading p { color: #64748b; font-size: 13px; margin: 0; line-height: 1.6; }
#generic-modal-alerts .alerts-filters {
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(240px, 1.2fr);
  gap: 16px 22px;
  padding: 20px;
  background: #fff;
  border: 1px solid #dfe7ef;
  border-radius: 12px;
}
#generic-modal-alerts .alerts-filters > div { min-width: 0; }
#generic-modal-alerts .alerts-field-label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; color: #52647a; }
#generic-modal-alerts .alerts-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
#generic-modal-alerts .alerts-quick-actions button {
  border: 1px solid #dbe6ee;
  background: #f6f9fc;
  color: #32637c;
  border-radius: 6px;
  padding: 5px 10px;
  min-height: 32px;
  font-size: 12px;
  cursor: pointer;
}
#generic-modal-alerts .alerts-quick-actions button:hover { background: #eaf4fa; border-color: #93c4d9; }
#generic-modal-alerts .alerts-selection-count { align-self: center; color: #64748b; font-size: 12px; margin-inline-end: auto; }
/* The count and its tooltip summarize selections without expanding the filter. */
#generic-modal-alerts #alerts-viz-plant-units .Select-multi-value-wrapper {
  display: block; max-height: 82px; overflow-y: auto;
}
#generic-modal-alerts .DateRangePicker { display: block; }
#generic-modal-alerts .DateRangePickerInput { border: 1px solid #d5e0e9; border-radius: 8px; display: flex; align-items: center; width: 100%; }
#generic-modal-alerts .DateInput { width: 44%; background: transparent; }
#generic-modal-alerts .DateInput_input { padding: 10px 8px; font-size: 13px; color: #334155; background: transparent; }
#generic-modal-alerts .DateRangePicker_picker { z-index: 20; }
#generic-modal-alerts .Select-control { border-color: #d5e0e9; border-radius: 8px; min-height: 40px; }
#generic-modal-alerts .Select-menu-outer { z-index: 15; }
#generic-modal-alerts .Select--multi .Select-value { background: #edf6fa; color: #176c8f; border-color: #cfe4ee; }
#generic-modal-alerts .alerts-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
#generic-modal-alerts .alerts-summary:empty { display: none; }
#generic-modal-alerts .alerts-summary-card {
  padding: 17px 18px;
  background: #fff;
  border: 1px solid #dfe7ef;
  border-top: 3px solid #177da5;
  border-radius: 10px;
  box-shadow: 0 3px 9px #30455b05;
}
#generic-modal-alerts .alerts-summary-card:nth-child(2) { border-top-color: #21856a; }
#generic-modal-alerts .alerts-summary-card:nth-child(3) { border-top-color: #8460b0; }
#generic-modal-alerts .alerts-summary-card:nth-child(4) { border-top-color: #d99024; }
#generic-modal-alerts .alerts-summary-card span { display: block; color: #64748b; font-size: 12px; margin-bottom: 6px; }
#generic-modal-alerts .alerts-summary-card strong { font-size: 27px; font-weight: 700; color: #263b50; font-variant-numeric: tabular-nums; }
#generic-modal-alerts .alerts-surface { background: #fff; border: 1px solid #dfe7ef; border-radius: 12px; min-width: 0; padding: 18px 12px 8px; }
#generic-modal-alerts .alerts-section-heading { padding: 0 8px 12px; }
#generic-modal-alerts .alerts-section-heading h5 { font-size: 15px; font-weight: 700; margin: 0 0 5px; }
#generic-modal-alerts .alerts-events { padding-bottom: 16px; }
#generic-modal-alerts .dash-spreadsheet-container { border: 1px solid #e7edf3; border-radius: 8px; }
#generic-modal-alerts .previous-next-container { margin-top: 10px; }
#generic-modal-alerts .alerts-config-panel { position: absolute; inset: 0; min-height: 0; }
#generic-modal-alerts .alerts-config-table {
  position: absolute;
  inset: 22px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid #dfe7ef;
  border-radius: 12px;
  background: white;
}
#generic-modal-alerts .alerts-config-header,
#generic-modal-alerts .alerts-config-row {
  display: grid;
  grid-template-columns: 32px minmax(140px, 1.1fr) minmax(145px, .8fr) minmax(200px, 1.4fr);
  margin: 0;
  gap: 16px;
  padding: 16px 20px;
}
#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: #f1f6fa; font-size: 12px; color: #52647a; border-bottom: 1px solid #dfe7ef; }
#generic-modal-alerts .alerts-config-row { border-bottom: 1px solid #edf1f5; font-size: 13px; min-height: 76px; }
#generic-modal-alerts .alerts-config-row:last-child { border-bottom: 0; }
#generic-modal-alerts .alerts-config-row:hover,
#generic-modal-alerts .alerts-config-row:focus-within { background: #f7fafc; }
#generic-modal-alerts .alerts-config-row:has(input:checked) { background: #f0f8fc; box-shadow: inset 3px 0 #177da5; }
#generic-modal-alerts .alerts-config-row .form-control { min-height: 40px; border-radius: 8px; border-color: #d5e0e9; }
#generic-modal-alerts .alerts-select { margin: 0; }
#generic-modal-alerts .alerts-select .form-check-input { height: 18px; width: 18px; cursor: pointer; }
#generic-modal-alerts .alerts-select label { position: absolute; height: 1px; width: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#generic-modal-alerts .alerts-mobile-label { display: none; }
/* Room for the final dropdown menu inside the independently scrolling tab. */
#generic-modal-alerts #alert-types-list:has(.is-open) { padding-bottom: 240px; }
#generic-modal-alerts :is(input, button, a, [tabindex]):focus-visible { outline: 2px solid #177da5; outline-offset: 3px; }
@media (max-width: 800px) {
  #generic-modal-alerts .alerts-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #generic-modal-alerts .alerts-filters { grid-template-columns: 1fr; }
  #generic-modal-alerts .alerts-config-header { display: none; }
  #generic-modal-alerts .alerts-config-row { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
  #generic-modal-alerts .alerts-config-row > :nth-child(3),
  #generic-modal-alerts .alerts-config-row > :nth-child(4) { grid-column: 2; }
  #generic-modal-alerts .alerts-mobile-label { display: block; font-size: 12px; color: #64748b; margin-bottom: 6px; }
}
@media (max-width: 480px) {
  #generic-modal-alerts.modal-dialog,
  #generic-modal-alerts .modal-dialog { width: calc(100vw - 12px) !important; max-width: calc(100vw - 12px) !important; margin: 6px auto; }
  #generic-modal-alerts .modal-content { height: calc(100vh - 12px); height: calc(100dvh - 12px); border-radius: 12px; }
  #generic-modal-alerts .modal-header,
  #generic-modal-alerts .modal-footer { padding: 12px 14px; }
  #generic-modal-alerts .nav-tabs { padding-inline: 12px; gap: 0; }
  #generic-modal-alerts .nav-tabs .nav-link { padding-inline: 14px; }
  #generic-modal-alerts .alerts-dashboard { padding: 16px 12px; gap: 14px; }
  #generic-modal-alerts .alerts-filters { padding: 14px; }
  #generic-modal-alerts .alerts-summary { gap: 9px; }
  #generic-modal-alerts .alerts-summary-card { padding: 12px; }
  #generic-modal-alerts .alerts-summary-card strong { font-size: 24px; }
  #generic-modal-alerts .alerts-config-table { inset: 14px 12px; }
  #generic-modal-alerts .alerts-config-row { padding: 14px 12px; }
  #generic-modal-alerts .DateInput_input { font-size: 12px; padding-inline: 5px; }
}

/* Readability pass: the original dashboard labels were difficult to read at
   normal desktop zoom. Keep controls and data legible without changing layout. */
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog {
  width: min(1500px, calc(100vw - 64px)) !important;
  max-width: min(1500px, calc(100vw - 64px)) !important;
}
#generic-modal-alerts .modal-content { height: 94vh; height: 94dvh; }
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog { margin-block: 3vh; }
#generic-modal-alerts .modal-dialog.modal-xl,
#generic-modal-alerts.modal-xl .modal-dialog {
  width: calc(100vw - 64px) !important;
  max-width: 1500px !important;
}
#generic-modal-alerts,
#generic-modal-alerts .modal-content { font-size: 15px; }
#generic-modal-alerts .modal-title { font-size: 23px; }
#generic-modal-alerts .nav-tabs .nav-link { font-size: 15px; }
#generic-modal-alerts .alerts-intro h4 { font-size: 23px; }
#generic-modal-alerts .alerts-intro p,
#generic-modal-alerts .alerts-section-heading p { font-size: 14px; }
#generic-modal-alerts .alerts-field-label { font-size: 14px; }
#generic-modal-alerts .alerts-quick-actions button { font-size: 13px; min-height: 36px; }
#generic-modal-alerts .alerts-selection-count { font-size: 13px; }
#generic-modal-alerts .DateInput_input { font-size: 15px; }
#generic-modal-alerts .Select-placeholder,
#generic-modal-alerts .Select-value-label,
#generic-modal-alerts .Select-input input { font-size: 14px; }
#generic-modal-alerts .alerts-summary-card { padding: 19px 20px; }
#generic-modal-alerts .alerts-summary-card span { font-size: 14px; }
#generic-modal-alerts .alerts-summary-card strong { font-size: 32px; }
#generic-modal-alerts .alerts-summary-card strong { line-height: 1.2; }
#generic-modal-alerts .alerts-section-heading h5 { font-size: 18px; }
#generic-modal-alerts .alerts-config-header { font-size: 14px; }
#generic-modal-alerts .alerts-config-row { font-size: 15px; }
#generic-modal-alerts .alerts-mobile-label { font-size: 14px; }
#generic-modal-alerts .alerts-config-row .form-control { font-size: 15px; }
#generic-modal-alerts .dash-spreadsheet-container,
#generic-modal-alerts .dash-spreadsheet-container * { font-size: 14px; }
#generic-modal-alerts .dash-spreadsheet-container th,
#generic-modal-alerts .dash-spreadsheet-container td { padding: 12px 14px !important; }
#generic-modal-alerts .modal-footer .btn { font-size: 15px; min-height: 46px; }
@media (max-width: 800px) {
  #generic-modal-alerts.modal-dialog,
  #generic-modal-alerts .modal-dialog { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; }
  #generic-modal-alerts .modal-dialog.modal-xl,
  #generic-modal-alerts.modal-xl .modal-dialog { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; }
  #generic-modal-alerts .modal-content { height: 94vh; height: 94dvh; }
}
/* One body scroller: content takes its natural height, including Plotly. */
#generic-modal-alerts .modal-body { overflow: auto !important; }
#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 { height: auto !important; }
#generic-modal-alerts .tab-content { position: static !important; height: auto !important; overflow: visible !important; }
#generic-modal-alerts .tab-pane { height: auto !important; }
#generic-modal-alerts .alerts-timeline-scroll { height: auto !important; overflow: visible !important; }
#generic-modal-alerts .alerts-config-panel { position: relative !important; padding: 20px; }
#generic-modal-alerts .alerts-config-table { position: relative !important; inset: auto !important; max-height: 60vh; }
/* Bound the complete dialog to the viewport. Only the tab content scrolls. */
body:has(#generic-modal-alerts.show),
body.modal-open { overflow: hidden !important; }
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog { margin: 12px auto !important; }
#generic-modal-alerts .modal-content {
  height: calc(100vh - 180px) !important;
  height: calc(100dvh - 180px) !important;
  max-height: calc(100dvh - 180px) !important;
}
#generic-modal-alerts .modal-body { overflow: hidden !important; }
#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 { height: 100% !important; min-height: 0; }
#generic-modal-alerts .tab-content {
  position: absolute !important; inset: 62px 0 0;
  height: auto !important; overflow: auto !important;
}
#generic-modal-alerts .nav-tabs { position: relative; z-index: 10; }
#generic-modal-alerts .alerts-config-panel { padding: 20px 20px 88px; }
#generic-modal-alerts .alerts-config-table { max-height: none; overflow: visible; }
#generic-modal-alerts .alerts-config-actions { padding: 14px 20px; display: flex; justify-content: flex-end; }
#generic-modal-apply-btn-alerts { display: none !important; }
#generic-modal-cancel-btn-alerts { background: #177da5; border-color: #177da5; color: white; }
/* The application header occupies space above the dialog host. Leave room
   for it as well as the footer instead of sizing to the full browser height. */
html:has(.alerts-modal-layout),
body:has(.alerts-modal-layout) { overflow: hidden !important; }
#generic-modal-alerts.modal-dialog,
#generic-modal-alerts .modal-dialog {
  margin-block: 8px !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 180px) !important;
}
#generic-modal-alerts .modal-header,
#generic-modal-alerts .modal-footer { flex-shrink: 0; }

/* ── Alerts configuration: summary toolbar + collapsible groups ── */
#generic-modal-alerts .alerts-config-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 20px;
  padding: 16px 20px; background: linear-gradient(180deg, #f8fbfd 0%, #eef5f9 100%);
  border-bottom: 1px solid #dfe7ef; border-radius: 12px 12px 0 0;
}
#generic-modal-alerts .alerts-config-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; min-width: 0; }
#generic-modal-alerts .alerts-config-total { display: flex; align-items: baseline; gap: 8px; }
#generic-modal-alerts .alerts-config-total-number { font-size: 26px; font-weight: 700; line-height: 1; color: #0f5f80; }
#generic-modal-alerts .alerts-config-total-label { font-size: 13px; color: #52647a; }
#generic-modal-alerts .alerts-config-channels { display: flex; flex-wrap: wrap; gap: 8px; }
#generic-modal-alerts .alerts-channel-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border: 1px solid #cfe3ee; border-radius: 999px; background: #fff; font-size: 12px; color: #34495e;
}
#generic-modal-alerts .alerts-channel-chip-number {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #177da5; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
#generic-modal-alerts .alerts-channel-chip.is-empty { color: #8a99ab; border-color: #e3e9ef; }
#generic-modal-alerts .alerts-channel-chip.is-empty .alerts-channel-chip-number { background: #cbd5df; }
#generic-modal-alerts .alerts-config-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#generic-modal-alerts .alerts-config-link-btn { background: transparent; border-color: transparent; color: #177da5; font-weight: 600; }
#generic-modal-alerts .alerts-config-link-btn:hover { background: #e3f0f6; border-color: transparent; color: #0f5f80; }

#generic-modal-alerts .alerts-group { border-bottom: 1px solid #dfe7ef; }
#generic-modal-alerts .alerts-group:last-child { border-bottom: 0; }
#generic-modal-alerts .alerts-group-summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; user-select: none;
  list-style: none; background: #f6f9fb; border-left: 4px solid #177da5; font-weight: 700; color: #1f3a4d;
}
#generic-modal-alerts .alerts-group-summary::-webkit-details-marker { display: none; }
#generic-modal-alerts .alerts-group-summary:hover { background: #edf4f8; }
#generic-modal-alerts .alerts-group-chevron {
  width: 8px; height: 8px; border-right: 2px solid #52647a; border-bottom: 2px solid #52647a;
  transform: rotate(-45deg); transition: transform .15s ease; margin-inline-end: 4px;
}
#generic-modal-alerts .alerts-group[open] > .alerts-group-summary .alerts-group-chevron { transform: rotate(45deg); }
#generic-modal-alerts .alerts-group-title { font-size: 14px; }
#generic-modal-alerts .alerts-group-count {
  margin-inline-start: auto; padding: 2px 10px; border-radius: 999px; background: #dcecf4; color: #0f5f80; font-size: 12px; font-weight: 700;
}
@media (max-width: 800px) {
  #generic-modal-alerts .alerts-config-toolbar { flex-direction: column; align-items: stretch; }
  #generic-modal-alerts .alerts-config-toolbar-actions { justify-content: space-between; }
  #generic-modal-alerts .alerts-group-summary { padding: 12px; }
}

/* ── Alerts overview: professional polish ── */
#generic-modal-alerts .alerts-intro {
  padding: 18px 22px; border-radius: 12px; border: 1px solid #d8e6ee;
  background: linear-gradient(135deg, #f1f8fc 0%, #ffffff 70%); border-inline-start: 5px solid #177da5;
}
#generic-modal-alerts .alerts-intro h4 { color: #16394d; letter-spacing: .1px; }

/* Filters card with a title */
#generic-modal-alerts .alerts-filters-card {
  background: #fff; border: 1px solid #dfe7ef; border-radius: 12px; box-shadow: 0 3px 10px #30455b08; overflow: visible;
}
#generic-modal-alerts .alerts-card-title {
  padding: 12px 20px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #52647a; background: #f6f9fb; border-bottom: 1px solid #e3eaf1; border-radius: 12px 12px 0 0;
}
#generic-modal-alerts .alerts-filters-card .alerts-filters { border: 0; border-radius: 0 0 12px 12px; box-shadow: none; padding: 18px 20px 20px; }
#generic-modal-alerts .alerts-field-label { text-transform: none; letter-spacing: .1px; color: #3d526a; }

/* Quick action buttons: pill style, the "active units" action stands out */
#generic-modal-alerts .alerts-quick-actions button { border-radius: 999px; padding: 5px 13px; font-weight: 600; transition: background .12s, border-color .12s; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-active { background: #177da5; border-color: #177da5; color: #fff; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-active:hover { background: #126385; border-color: #126385; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-clear { background: transparent; border-color: transparent; color: #8a4b4b; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-clear:hover { background: #fbeeee; }
#generic-modal-alerts .alerts-selection-count {
  padding: 3px 10px; border-radius: 999px; background: #eef3f7; color: #44566b; font-weight: 600;
}

/* Summary cards */
#generic-modal-alerts .alerts-summary-card { transition: transform .12s ease, box-shadow .12s ease; }
#generic-modal-alerts .alerts-summary-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px #30455b14; }
#generic-modal-alerts .alerts-summary-card span { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 600; }

/* Section cards: accent bar in the headings */
#generic-modal-alerts .alerts-surface { box-shadow: 0 3px 10px #30455b08; padding: 0 12px 10px; }
#generic-modal-alerts .alerts-section-heading { padding: 16px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid #edf1f5; }
#generic-modal-alerts .alerts-section-heading h5 { display: flex; align-items: center; gap: 10px; color: #1f3a4d; }
#generic-modal-alerts .alerts-section-heading h5::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: #177da5; }
#generic-modal-alerts .alerts-plot-viewport { border-radius: 10px; background: linear-gradient(180deg, #fbfdfe 0%, #f4f8fb 100%); margin-top: 8px; }

/* Events table: the global green header is overridden inside this dialog */
#generic-modal-alerts .dash-spreadsheet-container .dash-header,
#generic-modal-alerts .dash-table-container .dash-header,
#generic-modal-alerts .dash-spreadsheet-container .dash-header th,
#generic-modal-alerts .dash-table-container .dash-header th {
  background-color: #eef4f8 !important; color: #3d526a !important; font-size: .72rem !important;
  letter-spacing: .07em !important; border-color: #dfe7ef !important;
}
#generic-modal-alerts .dash-spreadsheet-container .dash-cell,
#generic-modal-alerts .dash-table-container .dash-cell { border-color: #edf1f5 !important; font-size: .85rem !important; }
#generic-modal-alerts .dash-spreadsheet-container tr:nth-child(even) .dash-cell,
#generic-modal-alerts .dash-table-container tr:nth-child(even) .dash-cell { background-color: #ffffff !important; }
#generic-modal-alerts .dash-spreadsheet-container tr:nth-child(odd) .dash-cell,
#generic-modal-alerts .dash-table-container tr:nth-child(odd) .dash-cell { background-color: #fafcfd !important; }
#generic-modal-alerts .dash-spreadsheet-container tr:hover .dash-cell,
#generic-modal-alerts .dash-table-container tr:hover .dash-cell { background-color: #eef7fb !important; }
#generic-modal-alerts .alerts-events .dash-spreadsheet-container { border-radius: 10px; }

/* Phones in landscape: use the full short viewport so header, tabs, content and footer all fit.
   !important is needed to beat the earlier "100dvh - 180px" bounds above. */
@media (orientation: landscape) and (max-height: 600px) {
  #generic-modal-alerts.modal-dialog,
  #generic-modal-alerts .modal-dialog {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    margin: 8px auto !important;
    max-height: calc(100dvh - 16px) !important;
  }
  #generic-modal-alerts .modal-content {
    height: calc(100dvh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 12px;
  }
  #generic-modal-alerts .modal-header { padding: 6px 16px; }
  #generic-modal-alerts .modal-title { font-size: 16px; }
  #generic-modal-alerts .modal-footer { padding: 6px 16px; }
  #generic-modal-alerts .modal-footer .btn { min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
  #generic-modal-alerts .nav-tabs { height: 44px; padding: 6px 16px 0; }
  #generic-modal-alerts .tab-content { inset: 44px 0 0 !important; }
  #generic-modal-alerts .alerts-dashboard { padding: 12px 16px 16px; }
  #generic-modal-alerts .alerts-plot-viewport { max-height: none; }
}

/* ── Alerts tab: refined filters layout and consistent controls ── */
/* Six-column grid: time range, customer and grouping on the first row; plant units and alert types share the second. */
#generic-modal-alerts .alerts-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 22px; }
#generic-modal-alerts .alerts-date-field,
#generic-modal-alerts .alerts-customer-field,
#generic-modal-alerts .alerts-group-field { grid-column: span 2; }
#generic-modal-alerts .alerts-units-field,
#generic-modal-alerts .alerts-types-field { grid-column: span 3; }
@media (max-width: 900px) {
  #generic-modal-alerts .alerts-filters { grid-template-columns: 1fr; }
  #generic-modal-alerts .alerts-date-field,
  #generic-modal-alerts .alerts-customer-field,
  #generic-modal-alerts .alerts-group-field,
  #generic-modal-alerts .alerts-units-field,
  #generic-modal-alerts .alerts-types-field { grid-column: auto; }
}
#generic-modal-alerts #alerts-date-custom { margin-top: 8px; }

/* Both multi-selects keep a compact, scrollable chip area. */
#generic-modal-alerts #alerts-viz-plant-units .Select-multi-value-wrapper,
#generic-modal-alerts #alerts-viz-types .Select-multi-value-wrapper { display: block; max-height: 82px; overflow-y: auto; }

/* One consistent look for the quick actions of both multi-selects. */
#generic-modal-alerts .alerts-quick-actions button#alerts-units-all,
#generic-modal-alerts .alerts-quick-actions button#alerts-types-all { background: #f6f9fc; border-color: #dbe6ee; color: #32637c; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-all:hover,
#generic-modal-alerts .alerts-quick-actions button#alerts-types-all:hover { background: #eaf4fa; border-color: #93c4d9; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-clear,
#generic-modal-alerts .alerts-quick-actions button#alerts-types-clear { background: #fff; border-color: #ead3d3; color: #9a4545; }
#generic-modal-alerts .alerts-quick-actions button#alerts-units-clear:hover,
#generic-modal-alerts .alerts-quick-actions button#alerts-types-clear:hover { background: #fbeeee; border-color: #d9a9a9; }

/* Filters header: the collapse arrow is a quiet icon button. */
#generic-modal-alerts .alerts-card-title { display: flex; align-items: center; justify-content: space-between; }
#generic-modal-alerts #alerts-filters-toggle {
  color: #52647a; text-decoration: none; font-size: 12px; line-height: 1; padding: 5px 9px; border-radius: 8px;
}
#generic-modal-alerts #alerts-filters-toggle:hover { background: #e4edf3; color: #1f3a4d; }
#generic-modal-alerts #alerts-filters-toggle:focus { box-shadow: none; }

/* Filter fields: consistent control height and a visible focus state. */
#generic-modal-alerts .alerts-filters .Select-control { min-height: 42px; background: #fff; }
#generic-modal-alerts .alerts-filters .Select.is-focused > .Select-control { border-color: #177da5; box-shadow: 0 0 0 3px #177da51f; }
#generic-modal-alerts .alerts-filters .DateRangePickerInput { min-height: 42px; background: #fff; }
#generic-modal-alerts .alerts-filters .Select--multi .Select-value { border-radius: 999px; font-size: 12px; }

/* Timeline card: a bit more room for the legend and the lanes. */
#generic-modal-alerts .alerts-timeline-plot { padding: 4px 6px 0; }
