.topbar-title { margin: 0; }
.app .topbar { grid-template-columns: minmax(max-content, .65fr) minmax(160px, 1.55fr); }
.sidebar-bottom form { margin: 0; }
.app .sidebar nav a[data-tooltip="Сравнение цен"] .nav-label { line-height: 1.3; }

.comparison { padding: 0 var(--gutter) 20px; }
.comparison-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  min-height: 68px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comparison-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.comparison-filters select {
  width: min(235px, 75vw);
  min-height: 38px;
  padding: 7px 10px;
  border-color: var(--control-border);
  font-size: 14px;
}
.comparison-toolbar p, .comparison-filters span, .comparison-legend { font-size: 13px; }
.comparison-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 13px;
  margin: 0;
  padding: 14px 0;
  list-style: none;
}

.comparison-scroll {
  width: 100%;
  max-height: max(350px, calc(100dvh - 260px));
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--background);
}
.comparison-table {
  width: max-content;
  min-width: 100%;
  border-spacing: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.comparison-table :is(th, td) {
  min-width: 108px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.comparison-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--topbar);
  font-weight: 600;
  white-space: nowrap;
}
.comparison-table tbody td { white-space: nowrap; }
.comparison-table tr > :first-child {
  position: sticky;
  left: 0;
  width: 285px;
  min-width: 285px;
  max-width: 285px;
  text-align: left;
  border-right: 1px solid var(--border);
}
.comparison-table thead th:first-child { z-index: 3; }
.comparison-table tbody th {
  z-index: 1;
  background: var(--background);
  font-weight: 600;
}
.comparison-table tbody tr:hover :is(th, td) { background: var(--topbar); }
.comparison-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.comparison-category { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.comparison-product { display: block; text-decoration: none; overflow-wrap: anywhere; }
.comparison-product:hover { color: var(--primary); text-decoration: underline; }
.comparison-table td.our-price, .comparison-table th.our-price { font-weight: 700; background: var(--soft); }
.comparison-badge { display: inline-block; padding: 3px 7px; border-radius: 6px; font-size: 12px; }
.comparison .below, .comparison-table td.below { background: #e0eee6; color: #145a40; }
.comparison .above-average, .comparison-table td.above-average { background: #fae7c6; color: #674108; }
.comparison .above-max, .comparison-table td.above-max { background: #f7ded9; color: #8d2e27; }
.comparison-table tbody tr:hover td.our-price { background: var(--highlight); }
.comparison-table tbody tr:hover td.our-price.below { background: #e0eee6; }
.comparison-table tbody tr:hover td.our-price.above-average { background: #fae7c6; }
.comparison-table tbody tr:hover td.our-price.above-max { background: #f7ded9; }
.comparison-empty { padding: 16px 0; }

.offer-detail {
  border: 0;
  padding: 2px 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.offer-detail:disabled { cursor: default; opacity: 1; text-decoration: none; }
.offer-detail:hover:not(:disabled) { color: var(--primary); }
.offer-dialog {
  width: min(495px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
}
.offer-dialog::backdrop { background: rgb(17 28 42 / .36); }
.offer-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.offer-dialog p { margin: 14px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.offer-dialog a { display: inline-block; color: var(--primary); }

@media (max-width: 1080px) {
  .app .topbar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .comparison-scroll { max-height: max(300px, calc(100dvh - 310px)); }
  .comparison-table tr > :first-child { width: 145px; min-width: 145px; max-width: 145px; }
  .comparison-table thead th:first-child { white-space: normal; }
  .comparison-table :is(th, td) { padding: 9px; }
}
