.app-select {
  position: relative;
  display: inline-grid;
  width: 100%;
  min-width: 0;
  vertical-align: middle;
}

.app-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(112, 221, 151, 0.34);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(8, 43, 29, 0.97), rgba(3, 25, 17, 0.97));
  box-shadow: inset 0 1px 0 rgba(218, 255, 230, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
  color: var(--ink, #effff4);
  font: inherit;
  font-weight: 720;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.app-select-trigger:hover,
.app-select-trigger:focus-visible,
.app-select-trigger[aria-expanded="true"] {
  border-color: rgba(144, 241, 170, 0.82);
  outline: none;
  background: linear-gradient(145deg, rgba(13, 59, 39, 0.98), rgba(4, 31, 21, 0.98));
  box-shadow: 0 0 0 3px rgba(112, 221, 151, 0.1), 0 12px 30px rgba(0, 0, 0, 0.16);
}

.app-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-select-trigger.is-placeholder .app-select-value {
  color: var(--muted, #8fa99a);
}

.app-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-select-chevron {
  width: 9px;
  height: 9px;
  justify-self: center;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.app-select-trigger[aria-expanded="true"] .app-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.app-select-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}

.app-select-overlay[hidden] {
  display: none;
}

.app-select-overlay::backdrop {
  background: transparent;
}

.app-select-popover {
  position: fixed;
  display: grid;
  gap: 10px;
  max-height: min(460px, calc(100dvh - 24px));
  padding: 12px;
  border: 1px solid rgba(122, 230, 159, 0.42);
  border-radius: 16px;
  background: rgba(4, 29, 19, 0.98);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(214, 255, 226, 0.06);
  color: var(--ink, #effff4);
  backdrop-filter: blur(18px);
}

.app-select-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.app-select-search-row[hidden] {
  display: none;
}

.app-select-search {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(122, 230, 159, 0.3);
  border-radius: 11px;
  background: rgba(1, 17, 11, 0.82);
  color: var(--ink, #effff4);
  font: inherit;
}

.app-select-search:focus {
  border-color: rgba(144, 241, 170, 0.82);
  outline: 3px solid rgba(112, 221, 151, 0.1);
}

.app-select-close {
  display: grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(122, 230, 159, 0.24);
  border-radius: 10px;
  background: rgba(11, 51, 34, 0.72);
  color: #a7f5bb;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.app-select-options {
  display: grid;
  gap: 5px;
  min-height: 0;
  max-height: 350px;
  overflow: auto;
  padding: 2px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(135, 231, 161, 0.45) rgba(4, 29, 19, 0.3);
}

.app-select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(8, 44, 29, 0.58);
  color: var(--soft, #d6eadc);
  font: inherit;
  font-weight: 680;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.app-select-option > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-select-option:hover,
.app-select-option:focus-visible {
  border-color: rgba(144, 241, 170, 0.5);
  outline: none;
  background: rgba(43, 119, 76, 0.3);
}

.app-select-option.is-selected {
  border-color: rgba(144, 241, 170, 0.66);
  background: linear-gradient(135deg, rgba(67, 159, 99, 0.38), rgba(18, 75, 49, 0.44));
  color: #b5ffc7;
}

.app-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.app-select-check {
  color: #9df5b5;
  font-size: 16px;
  text-align: center;
}

.app-select-group {
  margin: 7px 8px 2px;
  color: #79d99b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.app-select-empty {
  margin: 0;
  padding: 18px 12px;
  color: var(--muted, #8fa99a);
  text-align: center;
}

.mail-bulk-toolbar .app-select,
.mail-reader-move .app-select,
.head-actions .app-select,
.mail-head-actions .app-select {
  width: auto;
  min-width: 180px;
}

.mail-bulk-toolbar .app-select-trigger,
.mail-reader-move .app-select-trigger {
  min-height: 38px;
  padding-block: 6px;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) and (max-width: 1180px) {
  body.app-select-open {
    overflow: hidden;
  }

  .app-select-overlay {
    display: grid;
    align-items: end;
    justify-items: center;
    padding: 18px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: rgba(0, 12, 7, 0.72);
  }

  .app-select-overlay::backdrop {
    background: rgba(0, 12, 7, 0.2);
  }

  .app-select-popover {
    position: relative;
    width: min(100%, 620px);
    max-height: min(72dvh, 680px);
    padding: 16px;
    border-radius: 22px;
  }

  .app-select-options {
    max-height: min(56dvh, 540px);
  }

  .app-select-option {
    min-height: 50px;
    padding: 12px 14px;
  }

  .mail-bulk-toolbar .app-select,
  .mail-reader-move .app-select,
  .head-actions .app-select,
  .mail-head-actions .app-select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 699px) {
  .app-select-trigger {
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 13px;
  }

  .app-select-overlay {
    padding: 10px 8px max(10px, env(safe-area-inset-bottom));
  }

  .app-select-popover {
    width: 100%;
    max-height: min(82dvh, 650px);
    padding: 13px;
    border-radius: 20px 20px 14px 14px;
  }

  .app-select-options {
    max-height: min(65dvh, 500px);
  }

  .app-select-option {
    min-height: 48px;
    padding: 11px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-select-trigger,
  .app-select-chevron {
    transition: none;
  }
}
