.pdf-export-shortlist {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.58rem 0.9rem;
  border: 1px solid rgba(20, 109, 136, 0.28);
  border-radius: 999px;
  background: #e8f4f7;
  color: #08304a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.pdf-export-shortlist:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 109, 136, 0.55);
  background: #dff0f4;
}

.pdf-export-shortlist:focus-visible {
  outline: 3px solid rgba(20, 109, 136, 0.24);
  outline-offset: 2px;
}

.pdf-export-shortlist span {
  font-size: 1rem;
  line-height: 1;
}

.api-settings-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.58rem 0.9rem;
  border: 1px solid rgba(8, 48, 74, 0.24);
  border-radius: 999px;
  background: transparent;
  color: #08304a;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.api-settings-button:hover,
.api-settings-button.configured {
  transform: translateY(-1px);
  border-color: rgba(23, 150, 111, 0.5);
  background: rgba(23, 150, 111, 0.1);
}

.api-settings-button:focus-visible,
.api-modal button:focus-visible,
.api-modal input:focus-visible,
.api-modal select:focus-visible {
  outline: 3px solid rgba(20, 109, 136, 0.24);
  outline-offset: 2px;
}

.api-modal-open {
  overflow: hidden;
}

.api-modal-backdrop {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background: rgba(5, 28, 43, 0.7);
  backdrop-filter: blur(7px);
}

.api-modal-backdrop [hidden] {
  display: none !important;
}

.api-modal {
  position: relative;
  width: min(620px, 100%);
  padding: clamp(1.35rem, 4vw, 2.2rem);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 22px;
  background: #f7faf9;
  box-shadow: 0 30px 85px rgba(4, 31, 48, 0.38);
  color: #08304a;
}

.api-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 48, 74, 0.08);
  color: #08304a;
  font: inherit;
  font-size: 1.45rem;
  cursor: pointer;
}

.api-modal-heading {
  padding-right: 2.4rem;
}

.api-modal-heading h2 {
  margin: 0.15rem 0 0.55rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.08;
}

.api-modal-heading > p:last-child {
  margin: 0;
  color: #506873;
  line-height: 1.55;
}

.api-settings-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.35rem;
}

.api-settings-form label {
  display: grid;
  gap: 0.42rem;
  color: #183f54;
  font-size: 0.8rem;
  font-weight: 800;
}

.api-settings-form input,
.api-settings-form select {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(8, 48, 74, 0.2);
  border-radius: 11px;
  background: white;
  color: #08304a;
  font: inherit;
}

.api-settings-form small {
  color: #627680;
  font-size: 0.7rem;
  font-weight: 500;
}

.api-key-field > div {
  display: flex;
  gap: 0.5rem;
}

.api-key-toggle {
  flex: 0 0 auto;
  padding: 0 0.9rem;
  border: 1px solid rgba(8, 48, 74, 0.2);
  border-radius: 11px;
  background: #e8f4f7;
  color: #08304a;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.api-security-note {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(23, 150, 111, 0.22);
  border-radius: 12px;
  background: rgba(23, 150, 111, 0.08);
  color: #315d58;
}

.api-security-note > span {
  color: #17966f;
  font-size: 1.2rem;
  line-height: 1.3;
}

.api-security-note p {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
}

.api-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.15rem;
}

.api-modal-actions button {
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}

.api-clear-button {
  border: 1px solid rgba(8, 48, 74, 0.2);
  background: transparent;
  color: #506873;
}

.api-save-button {
  border: 1px solid #146d88;
  background: #146d88;
  color: white;
}

.live-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(20, 109, 136, 0.2);
  border-radius: 12px;
  background: rgba(232, 244, 247, 0.72);
  color: #08304a;
}

.live-source-bar > div {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.live-source-bar > div > span:last-child {
  display: grid;
  gap: 0.12rem;
}

.live-source-bar strong,
.live-source-bar small {
  display: block;
}

.live-source-bar strong {
  font-size: 0.82rem;
}

.live-source-bar small,
.source-policy {
  color: #506873;
  font-size: 0.72rem;
}

.source-policy {
  max-width: 310px;
  text-align: right;
}

.source-pulse {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #17966f;
  box-shadow: 0 0 0 5px rgba(23, 150, 111, 0.12);
}

.scan-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.scan-button.scanning .scan-label::before {
  content: "";
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 0.45rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.08rem;
  animation: wjg-spin 0.8s linear infinite;
}

@keyframes wjg-spin {
  to { transform: rotate(360deg); }
}

.empty-results {
  padding: 2.5rem;
  border: 1px dashed rgba(20, 109, 136, 0.35);
  border-radius: 16px;
  background: white;
  text-align: center;
  color: #506873;
}

.empty-results strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #08304a;
  font-size: 1.05rem;
}

.pdf-export-toast {
  position: fixed;
  z-index: 1000;
  right: 24px;
  bottom: 24px;
  max-width: min(390px, calc(100vw - 32px));
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: #08304a;
  box-shadow: 0 18px 48px rgba(8, 47, 73, 0.28);
  color: white;
  font-size: 0.88rem;
  font-weight: 750;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.pdf-export-toast[data-tone="warning"] {
  background: #8a5812;
}

.pdf-export-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .topbar nav .pdf-export-shortlist,
  .topbar nav .api-settings-button {
    width: 100%;
    justify-content: center;
  }

  .live-source-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-policy {
    max-width: none;
    padding-left: 1.6rem;
    text-align: left;
  }

  .api-modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .api-modal-actions button {
    width: 100%;
  }
}

@media print {
  .pdf-export-shortlist,
  .api-settings-button,
  .api-modal-backdrop,
  .pdf-export-toast {
    display: none !important;
  }

  .live-source-bar {
    display: none !important;
  }
}
