/* "Select Plant Units" dialogs: Irrigation Tracker and Limited Water Irrigation (scoped to these modals only). */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection).modal-dialog,
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-dialog {
  width: min(920px, calc(100vw - 24px)) !important;
  max-width: min(920px, calc(100vw - 24px)) !important;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-content {
  border: 1px solid #d8e4ec;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px #1b34491f;
  background: #fff;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-header {
  padding: 22px 28px;
  background: linear-gradient(135deg, #e6f2f8 0%, #ffffff 80%);
  border-bottom: 1px solid #dbe7ef;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-title { font-size: 24px; font-weight: 700; color: #16394d; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-title img { height: 34px; width: 34px; margin-inline-end: 12px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-body { padding: 0; }

/* Toolbar: search + counter + actions */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 18px 24px; background: #f7fafc; border-bottom: 1px solid #e3ebf2;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-search {
  flex: 1 1 260px; min-width: 0; height: 48px; padding: 8px 18px 8px 46px;
  border: 1px solid #d3dfe8; border-radius: 999px; font-size: 17px; color: #2b3f52; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px center;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-search:focus {
  outline: none; border-color: #177da5; box-shadow: 0 0 0 3px #177da51f;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-actions { display: flex; align-items: center; gap: 6px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-count {
  padding: 6px 14px; border-radius: 999px; background: #dcecf4; color: #0f5f80; font-size: 15px; font-weight: 700; white-space: nowrap;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-link {
  border: 0; background: transparent; color: #177da5; font-size: 16px; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-link:hover { background: #e3f0f6; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-link-muted { color: #8a4b4b; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-link-muted:hover { background: #fbeeee; }

/* List */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-scroll {
  max-height: min(66vh, 720px); overflow-y: auto; padding: 12px 18px 18px; scrollbar-gutter: stable;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-list { display: flex; flex-direction: column; gap: 2px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row {
  display: flex !important; align-items: center; gap: 14px; margin: 0 !important; padding: 13px 16px;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:hover { background: #f1f7fb; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:has(input:checked) { background: #eaf5fa; border-color: #b9dbe9; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-input { width: 22px; height: 22px; margin: 0 !important; accent-color: #177da5; flex: 0 0 auto; cursor: pointer; }
/* Leaders open a new group; followers are indented underneath */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:has(.pu-leader) { margin-top: 10px !important; background: #f4f9f5; border-left: 4px solid #1a7a3a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:has(.pu-leader):has(input:checked) { background: #e4f3e8; border-color: #9fd0ad; border-left: 4px solid #1a7a3a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:first-child { margin-top: 0 !important; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:has(.pu-follower) { margin-inline-start: 36px !important; border-left: 2px dashed #f0c27a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-option { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-name { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; font-size: 17px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-leader .pu-name { font-weight: 700; color: #1a4705; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-follower .pu-name { font-weight: 500; color: #8a5a10; font-style: italic; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-dot-leader { background: #1a7a3a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-dot-follower { background: #f09a1a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-badge {
  flex: 0 0 auto; padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .03em; font-style: normal;
}
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-badge-leader { background: #d8efe0; color: #14602d; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-badge-follower { background: #fdecd2; color: #8a5a10; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-empty { padding: 36px 12px; text-align: center; color: #64748b; font-size: 17px; }

/* Footer */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-footer { padding: 18px 28px; background: #f7fafc; border-top: 1px solid #e3ebf2; gap: 10px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .modal-footer .btn { min-width: 130px; min-height: 48px; font-size: 17px; border-radius: 10px; font-weight: 600; margin: 0; }
:is(#generic-modal-cancel-btn-irrigation-tracker-plant-unit-selection, #generic-modal-cancel-btn-limited-water-plant-unit-selection) { background: #fff !important; color: #475569 !important; border: 1px solid #ccd8e3 !important; }
:is(#generic-modal-cancel-btn-irrigation-tracker-plant-unit-selection, #generic-modal-cancel-btn-limited-water-plant-unit-selection):hover { background: #f1f5f9 !important; }
:is(#generic-modal-apply-btn-irrigation-tracker-plant-unit-selection, #generic-modal-apply-btn-limited-water-plant-unit-selection) { background: #177da5 !important; border-color: #177da5 !important; color: #fff !important; }
:is(#generic-modal-apply-btn-irrigation-tracker-plant-unit-selection, #generic-modal-apply-btn-limited-water-plant-unit-selection):hover { background: #126385 !important; border-color: #126385 !important; }
@media (max-width: 480px) {
  :is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-toolbar { padding: 12px; }
  :is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-name { font-size: 15px; }
  :is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-scroll { padding: 8px 8px 12px; max-height: 58vh; }
  :is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-row:has(.pu-follower) { margin-inline-start: 14px !important; }
}

/* Optional field above the search box (Limited Water: program name) */
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-top { padding: 20px 24px 6px; background: #fff; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-top-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #52647a; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-name-input { width: 100%; height: 48px; border: 1px solid #d3dfe8; border-radius: 10px; padding: 8px 14px; font-size: 17px; }
:is(#generic-modal-irrigation-tracker-plant-unit-selection, #generic-modal-limited-water-plant-unit-selection) .pu-select-name-input:focus { outline: none; border-color: #177da5; box-shadow: 0 0 0 3px #177da51f; }
