.chemrytiq-page .chemrytiq-compare-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  margin-top: 0.7rem;
  padding: 0 0.8rem;
  border: 1px solid #c7d7eb;
  border-radius: 0.65rem;
  background: #f8fbff;
  color: #164d7a;
  font-size: 0.84rem;
  font-weight: 850;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}

.chemrytiq-page .chemrytiq-analog-links .chemrytiq-compare-add {
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #7c3aed;
  min-height: 1.25rem;
  line-height: 1.2;
}

.chemrytiq-page .chemrytiq-compare-add:hover {
  transform: translateY(-1px);
  border-color: #8fb6df;
  background: #eef6ff;
}

.chemrytiq-page .chemrytiq-compare-add.is-selected {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.chemrytiq-compare-tray {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  width: min(26rem, calc(100vw - 2rem));
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid #cbd7e5;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.chemrytiq-compare-dismiss {
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.65rem;
  height: 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd7e5;
  border-radius: 999px;
  background: #ffffff;
  color: #52677d;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.chemrytiq-compare-dismiss:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.chemrytiq-compare-tray.is-visible {
  display: grid;
}

.chemrytiq-compare-tray.is-expanded {
  width: min(44rem, calc(100vw - 2rem));
}

.chemrytiq-compare-tray__main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  color: #52677d;
  font-size: 0.86rem;
}

.chemrytiq-compare-tray__main strong {
  color: #16324d;
  font-size: 0.98rem;
}

.chemrytiq-compare-tray:not(.is-expanded) .chemrytiq-compare-tray__main span {
  display: none;
}

.chemrytiq-compare-tray__items {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
}

.chemrytiq-compare-tray:not(.is-expanded) .chemrytiq-compare-tray__items {
  display: none;
}

.chemrytiq-compare-token {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 16rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #f8fbff;
  color: #284766;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chemrytiq-compare-token button {
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 900;
}

.chemrytiq-compare-tray__actions {
  display: flex;
  gap: 0.55rem;
}

.chemrytiq-compare-open,
.chemrytiq-compare-review,
.chemrytiq-compare-clear,
.chemrytiq-compare-export button {
  min-height: 2.45rem;
  padding: 0 0.95rem;
  border-radius: 0.65rem;
  font-size: 0.86rem;
  font-weight: 850;
}

.chemrytiq-compare-open {
  border: none;
  background: #1565c0;
  color: #ffffff;
}

.chemrytiq-compare-open:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chemrytiq-compare-clear {
  border: 1px solid #d7e1ec;
  background: #ffffff;
  color: #52677d;
}

.chemrytiq-compare-review {
  border: 1px solid #b8d3ee;
  background: #eef6ff;
  color: #0f5f9f;
}

.chemrytiq-compare-workspace {
  margin-top: 0;
}

.chemrytiq-compare-dialog {
  width: 100%;
  border: 1px solid #dce6f0;
  border-radius: 0.9rem;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.chemrytiq-compare-dialog__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #e4edf6;
  background: #f8fbff;
}

.chemrytiq-compare-dialog__head h3 {
  margin: 0;
  color: #10263d;
  font-size: 1.25rem;
}

.chemrytiq-compare-dialog__head p {
  margin: 0.25rem 0 0;
  color: #607288;
  font-size: 0.9rem;
}

.chemrytiq-compare-close {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid #cbd7e5;
  border-radius: 999px;
  background: #ffffff;
  color: #52677d;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.chemrytiq-compare-close:hover {
  border-color: #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}

.chemrytiq-compare-loading {
  padding: 1.4rem;
  color: #52677d;
  font-weight: 800;
}

.chemrytiq-compare-empty {
  display: grid;
  gap: 0.35rem;
  padding: 1.15rem 1.25rem;
  border: 1px dashed #cbd7e5;
  border-radius: 0.85rem;
  background: #f8fbff;
  color: #52677d;
  font-size: 0.92rem;
  line-height: 1.45;
}

.chemrytiq-compare-empty strong {
  color: #16324d;
  font-size: 1rem;
}

.chemrytiq-compare-empty ul {
  margin: 0.15rem 0 0;
  padding-left: 1.1rem;
}

.chemrytiq-compare-agreement {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #e4edf6;
  font-size: 0.9rem;
}

.chemrytiq-compare-agreement.is-agree {
  background: #f0fdf4;
  color: #166534;
}

.chemrytiq-compare-agreement.is-conflict {
  background: #fff7ed;
  color: #9a3412;
}

.chemrytiq-compare-table-wrap {
  overflow: auto;
  max-height: 70vh;
}

.chemrytiq-compare-section-label {
  padding: 0.8rem 1.25rem 0.35rem;
  color: #16324d;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chemrytiq-compare-table {
  width: 100%;
  min-width: 54rem;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.chemrytiq-compare-table--visual {
  min-width: 62rem;
}

.chemrytiq-compare-table th,
.chemrytiq-compare-table td {
  padding: 0.72rem 0.85rem;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.chemrytiq-compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
  color: #10263d;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chemrytiq-compare-table thead th span {
  display: inline-block;
  max-width: 18rem;
  margin-top: 0.25rem;
  color: #607288;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}

.chemrytiq-compare-table tbody th {
  width: 11rem;
  color: #52677d;
  font-weight: 850;
}

.chemrytiq-compare-table tr.is-different {
  background: #fbfdff;
}

.chemrytiq-compare-table--visual tbody td {
  min-width: 14rem;
}

.chemrytiq-compare-reference {
  background: #f5f9fd;
}

.chemrytiq-compare-value {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.chemrytiq-compare-value strong {
  color: #10263d;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.chemrytiq-compare-change {
  display: grid;
  gap: 0.48rem;
  min-width: 12rem;
}

.chemrytiq-compare-change__chip {
  justify-self: center;
  min-width: 4.5rem;
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  background: #edf5ff;
  color: #165a9f;
  text-align: center;
  font-weight: 900;
}

.chemrytiq-compare-change.is-up .chemrytiq-compare-change__chip,
.chemrytiq-compare-change.is-different .chemrytiq-compare-change__chip {
  background: #e9fbf2;
  color: #047857;
}

.chemrytiq-compare-change.is-down .chemrytiq-compare-change__chip {
  background: #eef5ff;
  color: #1d5fa7;
}

.chemrytiq-compare-change.is-same .chemrytiq-compare-change__chip {
  background: #f1f5f9;
  color: #52677d;
}

.chemrytiq-compare-change__track {
  position: relative;
  height: 0.24rem;
  border-radius: 999px;
  background: #e5ebf2;
  overflow: hidden;
}

.chemrytiq-compare-change__track span {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 0.18rem;
  border-radius: inherit;
  background: #8b5cf6;
}

.chemrytiq-compare-change.is-up .chemrytiq-compare-change__track span,
.chemrytiq-compare-change.is-different .chemrytiq-compare-change__track span {
  background: #3b82f6;
}

.chemrytiq-compare-change.is-same .chemrytiq-compare-change__track span {
  background: #94a3b8;
}

.chemrytiq-compare-category-row th {
  position: static;
  background: #eef6ff;
  color: #0f5f9f;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chemrytiq-compare-compound {
  display: grid;
  gap: 0.25rem;
  min-width: 10rem;
}

.chemrytiq-compare-compound strong {
  color: #10263d;
  overflow-wrap: anywhere;
}

.chemrytiq-compare-compound span {
  color: #607288;
  font-size: 0.78rem;
}

.chemrytiq-compare-export {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e4edf6;
  background: #f8fbff;
}

.chemrytiq-compare-export button {
  border: 1px solid #b8d3ee;
  background: #eef6ff;
  color: #0f5f9f;
}

@media (max-width: 760px) {
  .chemrytiq-compare-tray {
    grid-template-columns: 1fr;
    align-items: stretch;
    right: 0.75rem;
    bottom: 0.75rem;
    width: min(22rem, calc(100vw - 1.5rem));
  }

  .chemrytiq-compare-tray__actions {
    justify-content: stretch;
  }

  .chemrytiq-compare-open,
  .chemrytiq-compare-clear {
    flex: 1 1 auto;
  }

}
