/* start.tops.me — блок «Сделки агентов» и окно со сделками агента.
   Подключается поверх site.css только на start.tops.me. */

.deals,
.profile {
  --deal-card: #f5f5f5;
  --deal-ink: #141922;
  --deal-muted: #343b49;
  --deal-border: #e1e4e8;
  --deal-control: #414551;
}

/* ---------- Блок на странице ---------- */

.deals {
  min-width: 0;
  padding-block: clamp(30px, 5vw, 68px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 16px;
}

.deals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.deal-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(18px, 5vw, 46px);
  margin: 0 0 22px;
}
.deal-totals dt { color: #c9cfda; font-size: .875rem; }
.deal-totals dd {
  margin: 3px 0 0;
  font-size: clamp(17px, 2.2vw, 25px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* круглые кнопки ‹ › и × */
.rail-controls { display: flex; flex: none; gap: 8px; }
.rail-controls button,
.profile-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--deal-control);
  border-radius: 50%;
  background: transparent;
  color: #f7f8fb;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.rail-controls button:hover:not(:disabled),
.profile-close:hover { background: #252933; }
.rail-controls button:disabled { opacity: .35; cursor: default; }

/* карусель: у всех карточек строки выровнены (subgrid), листается по карточке */
.agent-list {
  display: grid;
  grid-template-rows: repeat(5, auto);
  grid-auto-flow: column;
  grid-auto-columns: clamp(236px, 31%, 333px);
  gap: 12px;
  margin-inline: -4px;
  padding: 5px 4px 15px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-color: #606779 transparent;
}

.agent-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--deal-border);
  border-radius: 22px;
  background: var(--deal-card);
  color: var(--deal-ink);
}
.agent-list > .agent-card {
  grid-row: span 5;
  grid-template-rows: subgrid;
  scroll-snap-align: start;
  scroll-margin-inline-start: 4px;
}
.agent-list > .agent-card:hover { border-color: #8199ff; }

.agent-avatar {
  display: block;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

.agent-identity { display: grid; align-content: center; gap: 3px; }
.agents-page .agent-name {
  margin: 0;
  color: inherit;
  font-size: clamp(22px, 2.65vw, 28px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.02em;
}
.agents-page .agent-location {
  margin: 0;
  color: var(--deal-muted);
  font-size: .95rem;
}

.agent-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}
.agent-metric { display: flex; flex-direction: column-reverse; justify-content: start; gap: 3px; }
.agent-metric dt {
  color: var(--deal-muted);
  font-size: .875rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.agent-metric dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.agent-earnings {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #e0e3e8;
}
.agent-earnings strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.agent-earnings small { color: var(--deal-muted); font-size: .875rem; }

.agent-card-action {
  display: block;
  align-self: end;
  padding: 10px;
  border: 1px solid #d6dce6;
  border-radius: 999px;
  font-weight: 640;
  text-align: center;
}

/* ---------- Окно агента ---------- */

.profile {
  width: min(960px, 100% - 26px);
  max-height: 91dvh;
  padding: 0 20px 20px;
  border: 1px solid #393939;
  border-radius: 28px;
  background: #08090c;
  color: #f7f8fb;
  overscroll-behavior: contain;
}
.profile::backdrop { background: rgb(0 0 0 / 76%); }
html:has(.profile[open]) { overflow: hidden; }

.profile-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 8px;
  background: #08090c;
}

.agent-profile-heading { grid-template-columns: auto 1fr; align-items: center; }
.agent-profile-heading .agent-avatar { width: 72px; height: 72px; }
.agent-profile-heading .agent-metrics-panel,
.agent-profile-heading .agent-earnings { grid-column: 1 / -1; }
.agents-page .agent-profile-heading .agent-name { font-size: clamp(25px, 4vw, 39px); font-weight: 450; letter-spacing: -.03em; }

.agents-page .deal-exchange-note {
  max-width: 64ch;
  margin: 26px 0 30px;
  padding-inline: clamp(10px, 2.5vw, 22px);
  color: #c9cfda;
  font-size: .925rem;
  line-height: 1.65;
}
.deal-exchange-note a { text-decoration: underline; }

.agent-deals {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.agent-deals > li {
  padding: 18px;
  border: 1px solid var(--deal-border);
  border-radius: 22px;
  background: var(--deal-card);
  color: var(--deal-ink);
}
.agents-page .agent-deals h3 { font-size: clamp(23px, 3.5vw, 31px); overflow-wrap: anywhere; }
.agents-page .agent-deals p {
  margin: 0;
  color: var(--deal-muted);
  font-size: .95rem;
}
.agents-page .agent-deals .deal-summary { margin-top: 10px; }

.deal-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 33%);
  align-items: start;
  gap: 16px;
}
.deal-text { display: grid; gap: 8px; margin: 12px 0; }
.deal-text strong { color: var(--deal-ink); }
.deal-screenshot {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 555px;
  margin-inline: auto;
  border-radius: 14px;
  object-fit: contain;
}

.profile-contact { display: flex; justify-content: center; margin-block: 24px 4px; }

/* ---------- Города в «Работаем в следующих странах» — ссылки в WhatsApp ---------- */

.agents-country a {
  text-decoration: underline;
  text-decoration-color: #747680;
  text-underline-offset: .18em;
}
.agents-country a:hover,
.agents-country a:focus-visible { color: #f7f8fb; }

@media (max-width: 760px) {
  .agent-list { grid-auto-columns: min(244px, 85%); }
  .deal-record { grid-template-columns: minmax(0, 1fr); }
  .profile { padding-inline: 12px; }
}
