/* Load last: keep neutral controls readable above the theme's generic button rule.
   Important colors are scoped to controls whose theme selectors use many :not(). */
.metis-app .metis-connections .accordion-button > i { flex: 0 0 auto; }
.metis-app .metis-connections .accordion-button > span:not(.metis-connection-status) { flex: 0 0 auto; }
.metis-app .metis-connection-status { flex: 1 1 auto !important; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: right; }
:is(#navToggle, .metis-admin .btn-close, #closeCompanyDialog) {
  color: #334155 !important;
  background: #fff !important;
  border: 1px solid #64748b;
  opacity: 1;
  filter: none;
  transition: none;
}

#navToggle > i {
  color: currentColor !important;
}

:is(#navToggle, .metis-admin .btn-close, #closeCompanyDialog):hover:not(:disabled):not([aria-disabled="true"]):not(.disabled) {
  color: #1e40af !important;
  background: #eff6ff !important;
  border-color: #1d4ed8;
  filter: none;
}

#navToggle[aria-expanded="true"] {
  color: #1e40af !important;
  background: #dbeafe !important;
  border-color: #1d4ed8;
}

:is(#navToggle, .metis-admin .btn-close, #closeCompanyDialog):active:not(:disabled):not([aria-disabled="true"]):not(.disabled) {
  color: #fff !important;
  background: #1e40af !important;
  border-color: #1e40af;
}

/* Draw the empty Bootstrap close button without an image/font dependency.
   The admin CSP allows only self-hosted images, so its data-URL X is blocked. */
.metis-admin .btn-close {
  position: relative;
  box-sizing: border-box;
  min-width: 36px;
  min-height: 36px;
}

.metis-admin .btn-close::before,
.metis-admin .btn-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}

.metis-admin .btn-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

#closeCompanyDialog {
  font-size: 24px;
  line-height: 1;
}

.metis-app #researchPanel .research-subtabs button {
  color: #334155 !important;
  background: #f1f5f9 !important;
  border: 1px solid #64748b;
  opacity: 1;
  filter: none;
  transition: none;
}

.metis-app #researchPanel .research-subtabs button:hover:not(:disabled):not([aria-disabled="true"]) {
  color: #1e40af !important;
  background: #dbeafe !important;
  border-color: #1d4ed8;
}

.metis-app #researchPanel .research-subtabs button:is([aria-current="page"], [aria-selected="true"], .active),
.metis-app #researchPanel .research-subtabs button:active:not(:disabled):not([aria-disabled="true"]) {
  color: #fff !important;
  background: #1e40af !important;
  border-color: #1e40af;
}

.metis-app #researchPanel .keyword-detail-link {
  color: #1d4ed8 !important;
  background: transparent !important;
  opacity: 1;
  filter: none;
  transition: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.metis-app #researchPanel .keyword-detail-link:hover:not(:disabled):not([aria-disabled="true"]) {
  color: #1e40af !important;
  background: #eff6ff !important;
  text-decoration-thickness: 2px;
  filter: none;
}

.metis-app #researchPanel .keyword-detail-link:active:not(:disabled):not([aria-disabled="true"]) {
  color: #1e3a8a !important;
  background: #dbeafe !important;
}

/* Keep disabled labels legible instead of fading the entire control. */
:is(#navToggle, .metis-admin .btn-close, #closeCompanyDialog,
    .metis-app #researchPanel .research-subtabs button,
    .metis-app #researchPanel .keyword-detail-link):is(:disabled, [aria-disabled="true"], .disabled) {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border-color: #94a3b8;
  opacity: 1;
  filter: none;
  cursor: not-allowed;
}

/* A white separator also keeps the blue ring distinct around blue buttons. */
:is(.metis-app, .metis-admin, .metis-auth-page) :focus-visible {
  outline: 3px solid #1d4ed8 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px #fff !important;
}

@media (forced-colors: active) {
  :is(.metis-app, .metis-admin, .metis-auth-page) :focus-visible {
    outline-color: Highlight !important;
  }

  .metis-admin .btn-close::before,
  .metis-admin .btn-close::after {
    background: ButtonText;
    forced-color-adjust: none;
  }
}
