/* Shared, keyboard-accessible dropdowns. Native selects remain form data only. */
.dropdown { position: relative; display: inline-flex; min-width: 0; max-width: 100%; vertical-align: middle; }
.dropdown > select[hidden] { display: none !important; }
.dropdown-trigger { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%; min-width: 0; min-height: 42px; padding: 10px 13px; border: 1px solid #d7e1db; border-radius: 8px; color: #263e2e; background: #fff; text-align: left; font-size: 13px; font-weight: 500; line-height: 1.5; transition: border-color .15s, box-shadow .15s, background .15s; }
.dropdown-trigger:hover:not(:disabled) { border-color: #9cb4a3; background: #fbfcfa; }
.dropdown-trigger:focus-visible, .dropdown-trigger[aria-expanded="true"] { border-color: #598169; outline: none; box-shadow: 0 0 0 3px #59816918; }
.dropdown-trigger[aria-invalid="true"] { border-color: #b94439; }
.dropdown-trigger:disabled { cursor: default; opacity: .6; }
.dropdown-value { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dropdown-chevron { flex: 0 0 7px; height: 7px; border-right: 1.5px solid #71887a; border-bottom: 1.5px solid #71887a; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.dropdown-trigger[aria-expanded="true"] .dropdown-chevron { transform: translateY(2px) rotate(225deg); }
.dropdown-popup { position: fixed; inset: auto; z-index: 30; margin: 0; padding: 6px; max-width: calc(100vw - 24px); border: 1px solid #d8e2dc; border-radius: 11px; background: #fff; color: #24382d; box-shadow: 0 12px 36px #19372620, 0 2px 6px #1937260d; overflow: hidden; font-family: inherit; font-size: 13px; font-weight: 400; line-height: 1.5; text-align: left; }
.dropdown-popup::backdrop { background: transparent; }
.dropdown-popup .dropdown-search { display: block; width: calc(100% - 8px); margin: 4px 4px 8px; min-height: 40px; padding: 9px 12px; border: 1px solid #dce5df; border-radius: 6px; background: #f7f9f7; color: #24382d; font: inherit; outline-offset: 0; }
.dropdown-search:focus { outline: 2px solid #64876e; outline-offset: 1px; }
.dropdown-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 1px; }
.dropdown-group + .dropdown-group { margin-top: 5px; padding-top: 5px; border-top: 1px solid #edf1ee; }
.dropdown-group-title { padding: 9px 11px 6px; font-size: 10px; font-weight: 650; letter-spacing: .07em; color: #6b7d70; overflow-wrap: anywhere; }
.dropdown-option { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 11px; border-radius: 6px; cursor: pointer; }
.dropdown-option[aria-selected="true"] { color: #245435; background: #f0f6eb; }
.dropdown-option.highlighted { background: #e8f0e4; }
.dropdown-option[aria-disabled="true"] { opacity: .45; cursor: default; }
.dropdown-option-copy { min-width: 0; display: grid; gap: 3px; }
.dropdown-option-title { font-weight: 500; overflow-wrap: anywhere; }
.dropdown-option-description { color: #6c7b70; font-size: 11px; font-weight: 400; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.dropdown-check { flex-shrink: 0; visibility: hidden; font-size: 14px; color: #356347; }
.dropdown-option[aria-selected="true"] .dropdown-check { visibility: visible; }
.dropdown-status { padding: 20px 12px; color: #718078; font-size: 12px; }
.field > .dropdown { display: flex; width: 100%; }
.org-select { min-width: 0; }
.org-select .dropdown { width: 240px; }
.org-select .dropdown-trigger { border-color: transparent; min-height: 38px; padding: 8px; background: transparent; }
.org-select .dropdown-trigger:hover { border-color: #dce5df; }
.env-bar .dropdown { margin-left: 8px; }
.import-entry .dropdown { width: 170px; }

/* The selected environment remains legible without exposing credentials. */
.environment-context { margin: 0 0 26px; border: 1px solid #dce5df; border-radius: 11px; background: #fff; overflow: hidden; }
.environment-context-main { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 20px 22px; }
.environment-mark { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 1px solid #dfe9d5; border-radius: 10px; background: #f1f6eb; color: #456a40; }
.environment-mark svg { width: 24px; height: 24px; }
.environment-picker { flex: 1 1 220px; min-width: 0; max-width: 440px; }
.environment-eyebrow { display: block; color: #798b7e; font-size: 10px; font-weight: 650; letter-spacing: .1em; line-height: 1.5; }
.environment-picker .dropdown { display: flex; width: 100%; margin: 3px 0 0 -6px; }
.environment-picker .dropdown-trigger { border-color: transparent; min-height: 32px; padding: 3px 7px; font-size: 17px; font-weight: 550; letter-spacing: -.025em; }
.environment-picker .dropdown-trigger:hover { border-color: #dce5df; }
.environment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.environment-actions button { min-height: 38px; padding: 8px 12px; gap: 9px; font-size: 11px; white-space: nowrap; }
.environment-actions .environment-add { background: #f6f8f4; }
.environment-add > span { font-size: 17px; line-height: 1; font-weight: 400; }
.environment-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; background: #eef2eb; color: #607758; font-size: 10px; }
.environment-context-footer { display: flex; align-items: center; gap: 20px; justify-content: space-between; padding: 13px 22px; border-top: 1px solid #edf1ed; background: #fafcf9; }
.environment-context-footer > div { min-width: 0; }
.environment-context .environment-description { margin: 0; color: #5d7064; font-size: 12px; line-height: 1.7; max-height: 100px; overflow-y: auto; }
.environment-context .environment-description-empty { color: #849187; }
.environment-edit { display: inline-flex; gap: 10px; align-items: center; flex-shrink: 0; padding: 4px 0; border: 0; background: transparent; font-size: 11px; font-weight: 550; color: #537044; }
.environment-edit:hover { color: #243b29; text-decoration: underline; }

/* An organization directory keeps destructive controls away from switching. */
dialog.environment-manager { width: min(780px, calc(100vw - 32px)); padding: 28px; }
.environment-manager > .environment-eyebrow { margin-bottom: 9px; }
.environment-manager > h2 { margin-bottom: 9px; font-size: 27px; }
.environment-manager > .modal-description { margin-bottom: 23px; font-size: 12px; }
.environment-manager-toolbar { display: flex; gap: 12px; margin-bottom: 20px; }
.environment-search { display: flex; align-items: center; flex: 1; gap: 10px; min-width: 0; padding: 9px 13px; border: 1px solid #dce5df; border-radius: 8px; background: #f8faf7; color: #738670; }
.environment-search:focus-within { outline: 2px solid #719477; outline-offset: 1px; }
.environment-search > span { font-size: 23px; line-height: 1; }
.environment-search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: #334b3b; font-size: 12px; }
.environment-manager-toolbar button { padding: 9px 14px; font-size: 12px; flex-shrink: 0; }
.environment-directory { max-height: 48vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 1px; }
.environment-project + .environment-project { margin-top: 23px; }
.environment-project-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 9px; padding: 0 3px; }
.environment-project-heading h3 { font-size: 12px; font-weight: 600; letter-spacing: 0; color: #405648; overflow-wrap: anywhere; }
.environment-project-heading > span { flex-shrink: 0; font-size: 10px; color: #869288; }
.environment-row { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid #e1e7e1; border-radius: 9px; background: #fff; }
.environment-row + .environment-row { margin-top: 7px; }
.environment-row.is-current { border-color: #cbdcbe; background: #f7faf3; }
.environment-row-icon { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 7px; background: #f2f5ef; color: #6a8265; }
.environment-row-icon svg, .environment-row-delete svg { width: 19px; height: 19px; }
.environment-row-copy { flex: 1; min-width: 0; }
.environment-row-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.environment-row-heading h4 { margin: 0; font-size: 13px; font-weight: 550; line-height: 1.5; overflow-wrap: anywhere; }
.environment-current { font-size: 9px; font-weight: 500; color: #557248; background: #e8f1dd; border-radius: 4px; padding: 2px 7px; }
.environment-row-copy p { margin-top: 3px; font-size: 11px; color: #7a887d; overflow-wrap: anywhere; white-space: pre-wrap; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.environment-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.environment-row-actions .secondary { padding: 6px 10px; font-size: 11px; }
.environment-row-edit, .environment-row-delete { padding: 6px 7px; background: transparent; border: 0; border-radius: 5px; font-size: 11px; font-weight: 500; color: #607260; }
.environment-row-edit:hover { background: #e9efe4; }
.environment-row-delete { display: grid; place-items: center; color: #9a7873; }
.environment-row-delete:hover { background: #fbefec; color: #a43d30; }
.environment-directory-empty { padding: 35px 20px; text-align: center; border: 1px dashed #dce4d9; border-radius: 9px; }
.environment-directory-empty svg { width: 28px; height: 28px; color: #6c8565; margin-bottom: 12px; }
.environment-directory-empty h3 { font-size: 15px; }
.environment-directory-empty p { margin-top: 8px; font-size: 12px; }
.environment-manager-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding-top: 20px; margin-top: 23px; border-top: 1px solid #edf1ec; }
.environment-manager-footer > span { font-size: 10px; color: #81917e; max-width: 300px; }
.environment-manager-footer .secondary { padding: 8px 18px; }
@media (max-width: 680px) {
  .org-select .dropdown { width: auto; max-width: 190px; }
  .environment-context-main { padding: 16px; gap: 11px; }
  .environment-mark { flex-basis: 36px; height: 36px; }
  .environment-picker { flex: 1 1 calc(100% - 50px); max-width: calc(100% - 50px); }
  .environment-picker .dropdown-trigger { font-size: 15px; }
  .environment-actions { width: 100%; margin-top: 3px; margin-left: 0; }
  .environment-actions button { flex: 1; padding: 8px; font-size: 10px; }
  .environment-context-footer { align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px 16px; }
  dialog.environment-manager { padding: 22px 18px; }
  .environment-manager-toolbar { flex-direction: column; }
  .environment-search { min-height: 42px; }
  .environment-directory { max-height: 44vh; }
  .environment-row { flex-wrap: wrap; gap: 10px; padding: 13px; }
  .environment-row-copy { flex-basis: calc(100% - 44px); }
  .environment-row-actions { width: 100%; padding-left: 40px; justify-content: flex-end; }
  .environment-row-actions > button { min-height: 34px; }
  .environment-manager-footer { margin-top: 16px; padding-top: 16px; }
}
