.pop-over {
  background: #fff;
  border-radius: 0.4vw;
  border: 1px solid #dbdbdb;
  border-bottom-color: #c2c2c2;
  box-shadow: 0 0.2vh 0.8vh rgba(0,0,0,0.3);
  position: absolute;
  /* Wider default to fit full color palette */
  width: min(380px, 55vw);
  z-index: 99999;
  margin-top: 0.7vh;
}
.pop-over hr {
  margin: 0.5vh 0px;
}
.pop-over p,
.pop-over textarea,
.pop-over input[type="text"],
.pop-over input[type="email"],
.pop-over input[type="password"],
.pop-over input[type="file"] {
  width: 100%;
}
.pop-over select {
  width: 100%;
  margin-bottom: 1.8vh;
}
.pop-over textarea {
  height: 9vh;
}
.pop-over form a span {
  padding: 0 0.7vw;
}
.pop-over .header {
  height: 4.5vh;
  position: relative;
  margin-bottom: 1vh;
  background: #f7f7f7;
  border-bottom: 1px solid #dcdcdc;
  color: #666;
}
.pop-over .header .header-title {
  display: block;
  line-height: 4vh;
  padding-top: 0.5vh;
  margin: 0 1.3vw;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pop-over .header .back-btn {
  float: left;
  overflow: hidden;
  width: 4vw;
  transition: width 0.2s;
}
.pop-over .header .back-btn i.fa {
  margin: 1.3vw;
  margin-top: 1.5vh;
}
.pop-over .header .back-btn.is-hidden {
  width: 0;
}
.pop-over .header .close-btn {
  padding: 1.3vh 1.3vw 1.3vh 0.5vw;
  position: absolute;
  top: 0;
  right: 0;
}
.pop-over.no-title .header {
  background: none;
}
.pop-over .content-wrapper {
  width: 100%;
  max-height: calc(70vh + 20px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Allow dynamic max-height to override default constraint */
.pop-over[style*="max-height"] .content-wrapper {
  max-height: inherit;
}
.pop-over .content-container {
  width: 100%;
  max-height: calc(70vh + 20px);
  transition: transform 0.2s;
}

/* Allow dynamic max-height to override default constraint for content-container */
.pop-over[style*="max-height"] .content-container {
  max-height: inherit;
}

/* Admin edit popups: use full height */
.pop-over[data-popup="editUser"],
.pop-over[data-popup="editOrg"],
.pop-over[data-popup="editTeam"] {
  height: calc(100vh - 20px) !important;
  max-height: calc(100vh - 20px) !important;
}

.pop-over[data-popup="editUser"] .content-wrapper,
.pop-over[data-popup="editOrg"] .content-wrapper,
.pop-over[data-popup="editTeam"] .content-wrapper {
  max-height: calc(100vh - 80px) !important; /* Subtract header height */
  height: calc(100vh - 80px) !important;
  overflow-y: auto !important;
}

.pop-over[data-popup="editUser"] .content-container,
.pop-over[data-popup="editOrg"] .content-container,
.pop-over[data-popup="editTeam"] .content-container {
  max-height: calc(100vh - 80px) !important; /* Subtract header height */
  height: calc(100vh - 80px) !important;
}

/* Ensure language popup list can scroll properly */
.pop-over .pop-over-list {
  max-height: none;
  overflow: visible;
}

/* Specific styling for language popup list */
.pop-over[data-popup="changeLanguage"] .pop-over-list {
  max-height: none;
  overflow: visible;
  height: auto;
  flex: 1;
}

/* Ensure content div in language popup contains all items */
.pop-over[data-popup="changeLanguage"] .content {
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Allow dynamic height for Change Language popup */
.pop-over[data-popup="changeLanguage"] .content-wrapper {
  max-height: inherit; /* Use dynamic height from JavaScript */
}

.pop-over[data-popup="changeLanguage"] .content-container {
  max-height: inherit; /* Use dynamic height from JavaScript */
}

/* Make language popup extend to bottom of browser window */
.pop-over[data-popup="changeLanguage"] {
  height: calc(100vh - 30px);
  min-height: 300px;
  /* Adjust positioning to move popup 30px higher */
  transform: translateY(-30px);
}

.pop-over[data-popup="changeLanguage"] .content-wrapper {
  height: calc(100% - 50px); /* Subtract header height more precisely */
  min-height: 250px;
  overflow-y: auto;
  max-height: none; /* Remove any max-height constraints */
  display: flex;
  flex-direction: column;
}

.pop-over[data-popup="changeLanguage"] .content-container {
  height: auto; /* Let content determine height */
  min-height: 250px;
  max-height: none; /* Remove any max-height constraints */
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Date popup sizing for native HTML inputs */
.pop-over[data-popup="editCardReceivedDatePopup"],
.pop-over[data-popup="editCardStartDatePopup"],
.pop-over[data-popup="editCardDueDatePopup"],
.pop-over[data-popup="editCardEndDatePopup"],
.pop-over[data-popup*="Date"] {
  width: min(400px, 90vw) !important; /* Smaller width for native inputs */
  min-width: 350px !important;
  max-height: 80vh !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .content-wrapper,
.pop-over[data-popup="editCardStartDatePopup"] .content-wrapper,
.pop-over[data-popup="editCardDueDatePopup"] .content-wrapper,
.pop-over[data-popup="editCardEndDatePopup"] .content-wrapper,
.pop-over[data-popup*="Date"] .content-wrapper {
  max-height: 60vh !important;
  overflow-y: auto !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .content-container,
.pop-over[data-popup="editCardStartDatePopup"] .content-container,
.pop-over[data-popup="editCardDueDatePopup"] .content-container,
.pop-over[data-popup="editCardEndDatePopup"] .content-container,
.pop-over[data-popup*="Date"] .content-container {
  max-height: 60vh !important;
}

/* Native HTML input styling */
.pop-over[data-popup*="Date"] .datepicker-container {
  width: 100% !important;
  padding: 15px !important;
}

.pop-over[data-popup*="Date"] .datepicker-container .fields {
  display: flex !important;
  gap: 15px !important;
  margin-bottom: 15px !important;
}

.pop-over[data-popup*="Date"] .datepicker-container .fields .left,
.pop-over[data-popup*="Date"] .datepicker-container .fields .right {
  flex: 1 !important;
  width: auto !important;
}

.pop-over[data-popup*="Date"] .datepicker-container label {
  display: block !important;
  margin-bottom: 5px !important;
  font-weight: bold !important;
}

.pop-over[data-popup*="Date"] .datepicker-container input[type="date"],
.pop-over[data-popup*="Date"] .datepicker-container input[type="time"] {
  width: 100% !important;
  padding: 8px !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
}

.pop-over[data-popup*="Date"] .datepicker-container input[type="date"]:focus,
.pop-over[data-popup*="Date"] .datepicker-container input[type="time"]:focus {
  outline: none !important;
  border-color: #007cba !important;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2) !important;
}

/* Ensure date popup buttons stay within popup boundaries */
.pop-over[data-popup="editCardReceivedDatePopup"] .content,
.pop-over[data-popup="editCardStartDatePopup"] .content,
.pop-over[data-popup="editCardDueDatePopup"] .content,
.pop-over[data-popup="editCardEndDatePopup"] .content,
.pop-over[data-popup*="Date"] .content {
  max-height: 60vh !important; /* Leave space for buttons */
  overflow-y: auto !important;
  padding-bottom: 100px !important; /* More space for buttons */
  margin-bottom: 0 !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .datepicker-container,
.pop-over[data-popup="editCardStartDatePopup"] .datepicker-container,
.pop-over[data-popup="editCardDueDatePopup"] .datepicker-container,
.pop-over[data-popup="editCardEndDatePopup"] .datepicker-container,
.pop-over[data-popup*="Date"] .datepicker-container {
  max-height: 50vh !important; /* Limit calendar height */
  overflow-y: auto !important;
  margin-bottom: 20px !important; /* Space before buttons */
}

/* Ensure buttons are properly positioned */
.pop-over[data-popup="editCardReceivedDatePopup"] .edit-date,
.pop-over[data-popup="editCardStartDatePopup"] .edit-date,
.pop-over[data-popup="editCardDueDatePopup"] .edit-date,
.pop-over[data-popup="editCardEndDatePopup"] .edit-date,
.pop-over[data-popup*="Date"] .edit-date {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .edit-date .fields,
.pop-over[data-popup="editCardStartDatePopup"] .edit-date .fields,
.pop-over[data-popup="editCardDueDatePopup"] .edit-date .fields,
.pop-over[data-popup="editCardEndDatePopup"] .edit-date .fields,
.pop-over[data-popup*="Date"] .edit-date .fields {
  flex-shrink: 0 !important;
  margin-bottom: 15px !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .edit-date .js-datepicker,
.pop-over[data-popup="editCardStartDatePopup"] .edit-date .js-datepicker,
.pop-over[data-popup="editCardDueDatePopup"] .edit-date .js-datepicker,
.pop-over[data-popup="editCardEndDatePopup"] .edit-date .js-datepicker,
.pop-over[data-popup*="Date"] .edit-date .js-datepicker {
  flex: 1 !important;
  overflow-y: auto !important;
}

.pop-over[data-popup="editCardReceivedDatePopup"] .edit-date button,
.pop-over[data-popup="editCardStartDatePopup"] .edit-date button,
.pop-over[data-popup="editCardDueDatePopup"] .edit-date button,
.pop-over[data-popup="editCardEndDatePopup"] .edit-date button,
.pop-over[data-popup*="Date"] .edit-date button {
  flex-shrink: 0 !important;
  margin-top: 15px !important;
  position: relative !important;
  z-index: 10 !important;
}
.pop-over .content-container .content {
  /* Match wider popover, leave padding */
  width: 100%;
  padding: 0 1.3vw 1.3vh;
  box-sizing: border-box;
  /* Ensure content is not shifted left */
  margin-left: 0 !important;
  transform: none !important;
}

/* Utility: remove left gutter inside specific popups */
.pop-over .content .flush-left {
  margin-left: 0;
  padding-left: 0;
  width: 100%;
}

/* Swimlane popups: remove left gutter, align content fully left */
.pop-over .content form.swimlane-color-popup,
.pop-over .content .swimlane-height-popup {
  margin-left: 0;
  padding-left: 0;
  width: 100%;
}

/* Color selection popups: ensure proper alignment */
.pop-over .content form.swimlane-color-popup .palette-colors,
.pop-over .content form.edit-label .palette-colors,
.pop-over .content form.create-label .palette-colors {
  margin-left: 0;
  padding-left: 0;
  width: 100%;
}

/* Color palette items: ensure proper positioning */
.pop-over .content .palette-colors .palette-color {
  margin-left: 0;
  margin-right: 2px;
  margin-bottom: 2px;
}

/* Global fix for all popup content to prevent left shifting */
.pop-over .content * {
  margin-left: 0 !important;
  transform: none !important;
}

/* Override any potential left shifting for specific elements */
.pop-over .content form,
.pop-over .content .palette-colors,
.pop-over .content .pop-over-list,
.pop-over .content .flush-left {
  margin-left: 0 !important;
  padding-left: 0 !important;
  transform: none !important;
}

/* Fix popup depth containers that cause left shifting */
.pop-over .popup-container-depth-1,
.pop-over .popup-container-depth-2,
.pop-over .popup-container-depth-3,
.pop-over .popup-container-depth-4,
.pop-over .popup-container-depth-5,
.pop-over .popup-container-depth-6 {
  transform: none !important;
  margin-left: 0 !important;
  padding-left: 0 !important;
}

/* Ensure buttons don’t reserve left space; align to flow */
.pop-over .content form.swimlane-color-popup .primary.confirm,
.pop-over .content form.swimlane-color-popup .negate.wide.right,
.pop-over .content .swimlane-height-popup .primary.confirm,
.pop-over .content .swimlane-height-popup .negate.wide.right {
  float: none;
  margin-left: 0;
}
.pop-over .content-container .content.no-height {
  height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  visibility: hidden;
}
.pop-over .quiet {
/*  padding: 6px 6px 4px;*/
}
.pop-over.search-over {
  background: #f0f0f0;
  min-height: 14vh;
}
.pop-over.search-over .header {
  display: none;
}
.pop-over.search-over .content {
  padding: 8px 4px 8px 10px;
  margin-right: 8px;
}
.pop-over .at-form .at-error,
.pop-over .at-form .at-result {
  padding: 8px 12px;
  margin: 0 0 10px 0;
}
.pop-over .at-form .at-error {
  background: #ef9a9a;
}
.pop-over .at-form .at-result {
  background: #b2dfdb;
}
.pop-over .sk-spinner {
  margin: 40px auto;
}
.pop-over .popup-container-depth-1 {
  transform: translateX(-300px);
}
.pop-over .popup-container-depth-2 {
  transform: translateX(-600px);
}
.pop-over .popup-container-depth-3 {
  transform: translateX(-900px);
}
.pop-over .popup-container-depth-4 {
  transform: translateX(-1200px);
}
.pop-over .popup-container-depth-5 {
  transform: translateX(-1500px);
}
.pop-over .popup-container-depth-6 {
  transform: translateX(-1800px);
}
.select-members-list,
.select-avatars-list {
  margin-bottom: 8px;
}
.pop-over-list li {
  display: block;
  clear: both;
}
.pop-over-list li > a {
  clear: both;
  cursor: pointer;
  display: block;
  font-weight: 700;
  padding: 1.5px 10px;
  position: relative;
  margin: 0;
  text-decoration: none;
  overflow: hidden;
  line-height: 33px;
  display:flex;
/*  flex-wrap:wrap;*/
  gap:5px;
  align-items: center;
}
.pop-over-list li > a > .member{
  align-self: flex-start;
  flex:0 0 auto;
}
.pop-over-list li > a .item-name {
  display: block;
  width: auto;
  padding-right: 22px;
}
.pop-over-list li > a:not(.disabled):hover {
  background-color: #005377;
  color: #fff;
}
.pop-over-list li > a:not(.disabled):hover .sub-name,
.pop-over-list li > a:not(.disabled):hover .quiet {
  color: #eee;
}
.pop-over-list li > a:not(.disabled):hover .unread-indicator {
  background: #fff;
}
.pop-over-list li > a .sub-name {
  color: #8c8c8c;
  display: block;
  font-size: 12px;
  font-weight: 400;
  line-height: 15px;
}
.pop-over-list li > a.current {
  background-color: #e2e6e9;
}
.pop-over-list li > a:active {
  background-color: #2e85b8;
}
.pop-over-list li > a.disabled {
  color: #8c8c8c;
  cursor: default;
}
.pop-over-list li > a.disabled .vis-icon {
  opacity: 0.35;
}
.pop-over-list li > a.disabled:hover {
  background: none;
}
.pop-over-list li > a.disabled:hover .sub-name,
.pop-over-list li > a.disabled:hover .quiet {
  color: #8c8c8c;
}
.pop-over-list li > a.disabled:active {
  background: none;
}
.pop-over-list.inset li > a {
  border-radius: 3px;
  margin: 0;
}
.pop-over-list .pop-over-list.checkable .fa-check {
  display: none;
  position: absolute;
  top: 6px;
  right: 12px;
}
.pop-over-list .pop-over-list.checkable li.active a {
  padding-right: 28px;
}
.pop-over-list .pop-over-list.checkable li.active a .fa-check {
  display: block;
}
.pop-over.miniprofile .header {
  border-bottom-color: transparent;
  height: 30px;
  position: absolute;
  right: 0;
  top: 0;
  width: 60px;
  z-index: 1;
}
.pop-over.miniprofile .header-title {
  display: none;
}
.pop-over.miniprofile .pop-over-list {
  padding-top: 8px;
}
.pop-over.miniprofile .miniprofile-header {
  margin-top: 8px;
  min-height: 56px;
  position: relative;
}
.pop-over.miniprofile .miniprofile-header .member,
.pop-over.miniprofile .miniprofile-header .avatar {
  position: absolute;
  top: 2px;
  left: 2px;
  height: 50px;
  width: 50px;
}
.pop-over.miniprofile .miniprofile-header .info {
  margin: 0 0 0 64px;
  word-wrap: break-word;
}
.pop-over.miniprofile .miniprofile-header .info h3 a {
  text-decoration: none;
}
.pop-over.miniprofile .miniprofile-header .info h3 a:hover {
  text-decoration: underline;
}
@media screen and (max-width: 800px) {
  .pop-over {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin-top: 0px;
    border: 0px solid #dbdbdb;
  }
  .pop-over .header {
    color: #fff;
    background: #2980b9;
    height: 48px;
    padding: 0px 0px;
    border: 0px;
    margin: 0px 0px;
    width: 100%;
    position: absolute;
    top: 0px;
  }
  .pop-over .header .header-title {
    font-size: 20px;
    font-weight: normal;
    padding-top: 8px;
  }
  .pop-over .header .back-btn {
    width: 30px;
    padding: 8px 12px 8px 12px;
  }
  .pop-over .header .back-btn i.fa {
    color: #fff;
  }
  .pop-over .header .close-btn {
    padding: 10px 12px;
  }
  .pop-over .header .close-btn i.fa {
    font-size: 24px;
    color: #fff;
  }
  .pop-over .content-wrapper {
    width: 100%;
    height: calc(100% - 48px);
    overflow-y: scroll;
    overflow-x: hidden;
    margin: 48px 0px 0px 0px;
  }
  .pop-over .content-container {
    width: 100%;
    height: 100%;
    max-height: 100%;
  }
  .pop-over .content-container .content {
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    padding: 10px;
  }
  .pop-over .content-container .content form {
    margin: 10px 10px;
    width: calc(100% - 20px);
  }
  .pop-over .content-container .content p,
  .pop-over .content-container .content textarea,
  .pop-over .content-container .content input[type="text"],
  .pop-over .content-container .content input[type="email"],
  .pop-over .content-container .content input[type="password"],
  .pop-over .content-container .content input[type="file"] {
    width: 100%;
    box-sizing: border-box;
  }
  .pop-over .pop-over-list li > a {
    width: calc(100% - 20px);
    margin: 0px 0px;
  }
  .pop-over .popup-container-depth-1 {
    transform: none !important;
  }
  .pop-over .popup-container-depth-2 {
    transform: none !important;
  }
  .pop-over .popup-container-depth-3 {
    transform: none !important;
  }
  .pop-over .popup-container-depth-4 {
    transform: none !important;
  }
  .pop-over .popup-container-depth-5 {
    transform: none !important;
  }
  .pop-over .popup-container-depth-6 {
    transform: none !important;
  }
}
