/* ═══════════════════════════════════════════════════════════════════
   TIMELINE v2, horizontal draggable track
   ═══════════════════════════════════════════════════════════════════ */

.tl2 {
  position: relative;
  margin-top: 18px;
  padding: 88px 40px 120px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  user-select: none;
}

/* baseline axis */
.tl2-axis {
  position: absolute;
  left: 40px; right: 40px;
  top: 50%;
  height: 2px;
  background: var(--hairline);
  border-radius: 2px;
}

/* 90-day band overlay */
.tl2-band {
  position: absolute;
  top: calc(50% - 16px);
  height: 32px;
  background: color-mix(in oklab, #02B140 10%, var(--surface));
  border-top: 1.5px dashed color-mix(in oklab, #02B140 55%, var(--hairline));
  border-bottom: 1.5px dashed color-mix(in oklab, #02B140 55%, var(--hairline));
  pointer-events: none;
  /* shift so it sits relative to padded track area */
  margin-left: 0;
}
.tl2-axis, .tl2-band, .tl2-months, .tl2-payouts, .tl2-handle { left: 40px; }
.tl2-band, .tl2-months, .tl2-payouts { right: auto; }

/* We position children using left: X% where % is relative to full tl2 width.
   To use the padded area cleanly, we instead wrap positions. Simpler:
   apply left/right 40px to the .tl2 track via an inner wrapper. */

.tl2 {
  padding: 128px 0 168px;
}
.tl2-axis, .tl2-band, .tl2-months, .tl2-payouts { left: 40px; right: 40px; }
.tl2-band { right: auto; }
.tl2-handle { left: 40px; right: auto; }

/* Months row (below axis) — sits well clear of the onboard handle card */
.tl2-months {
  position: absolute;
  top: calc(50% + 96px);
  height: 40px;
  pointer-events: none;
}
.tl2-month {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mute);
  text-align: center;
}
.tl2-month-tick {
  width: 1px; height: 10px;
  background: var(--hairline);
  margin: 0 auto 6px;
}
.tl2-month-lbl { white-space: nowrap; }

/* Payout markers, dot sits ON the axis, stem + label go UP above axis */
.tl2-payouts {
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: none;
}
.tl2-payout {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--brand-fg);
  padding-bottom: 2px;
}
.tl2-payout-lbl-m {
  font-family: var(--ff-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 4px;
  white-space: nowrap;
}
.tl2-payout-lbl {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--brand-fg);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface);
  padding: 3px 8px;
  border: 1px solid color-mix(in oklab, var(--brand-fg) 40%, var(--hairline));
  border-radius: 6px;
  margin-bottom: 6px;
}
.tl2-payout-stem {
  width: 1px;
  height: 18px;
  background: color-mix(in oklab, var(--brand-fg) 55%, var(--hairline));
}
.tl2-payout-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--brand-fg);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--brand-fg), 0 2px 8px color-mix(in oklab, var(--brand-fg) 40%, transparent);
  margin-top: -5.5px;
}

/* +90 end marker inside band */
.tl2-90-end {
  position: absolute;
  right: -1px; top: 50%;
  transform: translate(50%, -50%);
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #02B140;
  background: var(--surface);
  border: 1px solid color-mix(in oklab, #02B140 45%, var(--hairline));
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Draggable handles */
.tl2-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 5;
  outline: none;
}
.tl2-handle.dragging { cursor: grabbing; z-index: 10; }
.tl2-handle:focus-visible .tl2-handle-card {
  box-shadow: 0 0 0 3px color-mix(in oklab, currentColor 30%, transparent);
}

.tl2-handle-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: currentColor;
  border: 3px solid var(--surface);
  margin: 0 auto;
  box-shadow: 0 0 0 1.5px currentColor, 0 4px 14px color-mix(in oklab, currentColor 35%, transparent);
  transition: transform var(--dur) var(--ease);
}
.tl2-handle:hover .tl2-handle-dot,
.tl2-handle.dragging .tl2-handle-dot { transform: scale(1.12); }

.tl2-handle-card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 12px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid currentColor;
  border-radius: 10px;
  padding: 8px 14px 9px;
  box-shadow: 0 6px 18px color-mix(in oklab, currentColor 18%, transparent);
  white-space: nowrap;
  transition: box-shadow var(--dur) var(--ease);
  z-index: 6;
}
.tl2-handle-lbl {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.75;
  margin-bottom: 2px;
}
.tl2-handle-date {
  font-family: var(--ff-sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
}

/* Handles */
.tl2-handle--onboard { color: #3C7EF5; }
.tl2-handle--issue   { color: #02B140; }

/* Issue handle card points upward (sits above axis) */
.tl2-handle--issue .tl2-handle-card {
  margin-top: 0;
  top: auto;
  bottom: 28px;
}
.tl2-handle--issue .tl2-handle-card::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -6px;
  width: 10px; height: 10px;
  background: var(--surface);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

/* Onboard handle card points downward (sits below axis) */
.tl2-handle--onboard .tl2-handle-card::before {
  content: '';
  position: absolute;
  left: 50%; top: -6px;
  width: 10px; height: 10px;
  background: var(--surface);
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

/* dragging state mutes payouts/months for focus */
.tl2--dragging .tl2-payouts,
.tl2--dragging .tl2-months { opacity: 0.55; }

.tl2-hint {
  margin-top: 14px;
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
  text-align: center;
}

/* Summary list, clean 3-column card grid */
.tl2-summary {
  margin-top: 26px;
  padding: 22px 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.tl2-sum-title {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin-bottom: 16px;
}
.tl2-sum-list {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tl2-sum-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  min-width: 0;
}
.tl2-sum-n {
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.tl2-sum-m {
  font-family: var(--ff-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.tl2-sum-arr { display: none; }
.tl2-sum-p {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--brand-fg);
  white-space: nowrap;
  padding-top: 6px;
  border-top: 1px dashed var(--hairline);
  margin-top: 2px;
}
.tl2-sum-p::before {
  content: 'Выплата · ';
  color: var(--fg-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 9.5px;
}
:lang(en) .tl2-sum-p::before, [lang="en"] .tl2-sum-p::before { content: 'Payout · '; }

@media (max-width: 860px) {
  .tl2-sum-list { grid-template-columns: 1fr; }
}

/* Status header inside summary */
.tl2-status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tl2-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}
.tl2-badge--ok {
  color: #02B140;
  border-color: color-mix(in oklab, #02B140 55%, var(--hairline));
  background: color-mix(in oklab, #02B140 8%, var(--surface));
}
.tl2-badge--miss {
  color: #C44646;
  border-color: color-mix(in oklab, #C44646 55%, var(--hairline));
  background: color-mix(in oklab, #C44646 8%, var(--surface));
}
.tl2-status-note {
  font-family: var(--ff-sans);
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.45;
}
.tl2-sum-empty {
  padding: 8px 0 4px;
  font-family: var(--ff-sans);
  font-size: 13.5px;
  color: var(--fg-mute);
  line-height: 1.55;
}

/* Miss state: band and issue handle go red */
.tl2--miss .tl2-band {
  background: color-mix(in oklab, #C44646 9%, var(--surface));
  border-top-color: color-mix(in oklab, #C44646 50%, var(--hairline));
  border-bottom-color: color-mix(in oklab, #C44646 50%, var(--hairline));
}
.tl2--miss .tl2-90-end {
  color: #C44646;
  border-color: color-mix(in oklab, #C44646 45%, var(--hairline));
}
.tl2--miss .tl2-handle--issue { color: #C44646; }

@media (max-width: 720px) {
  .tl2 { padding: 72px 0 110px; }
  .tl2-axis, .tl2-band, .tl2-months, .tl2-payouts { left: 20px; right: 20px; }
  .tl2-handle { left: 20px; }
  .tl2-payout-lbl { font-size: 9.5px; }
  .tl2-month-lbl { font-size: 9.5px; }
}

/* ═══ Mobile <560px: vertical interactive timeline ═══ */
@media (max-width: 560px) {
  .tl-legend { display: none; }
  .tl2 {
    padding: 16px 0;
    height: 600px;
    width: 100%;
    max-width: 360px;
    margin: 24px auto 0;
    position: relative;
  }
  /* Re-anchor children to top/bottom rather than left/right */
  .tl2[data-orient="vertical"] .tl2-axis,
  .tl2[data-orient="vertical"] .tl2-band,
  .tl2[data-orient="vertical"] .tl2-months,
  .tl2[data-orient="vertical"] .tl2-payouts {
    left: 50%;
    right: auto;
    top: 24px;
    bottom: 24px;
    width: auto;
    height: auto;
  }
  /* Vertical axis line (1px wide, full height) */
  .tl2[data-orient="vertical"] .tl2-axis {
    width: 1px;
    transform: translateX(-50%);
  }
  /* Vertical 90-day band */
  .tl2[data-orient="vertical"] .tl2-band {
    width: 8px;
    transform: translateX(-50%);
    border-radius: 6px;
  }
  /* +90 marker — flip from end to bottom of band */
  .tl2[data-orient="vertical"] .tl2-90-end {
    right: auto;
    top: auto;
    bottom: -1px;
    left: 50%;
    transform: translate(-50%, 50%);
  }
  /* Months column — labels on the right of the axis */
  .tl2[data-orient="vertical"] .tl2-months { width: 0; }
  .tl2[data-orient="vertical"] .tl2-month {
    left: auto;
    top: var(--top, 0);
    transform: translateY(-50%);
    flex-direction: row;
    align-items: center;
    width: 80px;
    margin-left: 14px;
  }
  .tl2[data-orient="vertical"] .tl2-month-tick {
    width: 8px; height: 1px;
    margin: 0;
  }
  .tl2[data-orient="vertical"] .tl2-month-lbl {
    margin-top: 0;
    margin-left: 6px;
    font-size: 10px;
  }
  /* Handles — slide along Y, cards extend to the LEFT of the axis */
  .tl2[data-orient="vertical"] .tl2-handle {
    left: 50%;
    top: auto;
    transform: translate(-50%, -50%);
  }
  .tl2[data-orient="vertical"] .tl2-handle-card {
    position: absolute;
    right: calc(50% + 22px);
    left: auto;
    top: 50%;
    bottom: auto;
    margin-top: 0;
    transform: translateY(-50%);
    text-align: right;
    white-space: normal;
    max-width: 110px;
    padding: 6px 10px 7px;
  }
  .tl2[data-orient="vertical"] .tl2-handle--issue .tl2-handle-card {
    right: auto;
    left: calc(50% + 22px);
    top: 50%;
    bottom: auto;
    margin-top: 0;
    text-align: left;
  }
  .tl2[data-orient="vertical"] .tl2-handle-date { font-size: 12px; }
  .tl2[data-orient="vertical"] .tl2-handle-lbl { font-size: 9px; }
  /* On <=360px viewports, hide the month labels (avoid card collisions) */
  @media (max-width: 380px) {
    .tl2[data-orient="vertical"] .tl2-month-lbl { display: none; }
    .tl2[data-orient="vertical"] .tl2-month-tick { width: 5px; }
  }
  /* Hide pseudo arrows (designed for horizontal stacked cards) */
  .tl2[data-orient="vertical"] .tl2-handle-card::before,
  .tl2[data-orient="vertical"] .tl2-handle-card::after { display: none; }
  /* Hint text under track */
  .tl2-hint { font-size: 12px; padding: 0 8px; }
}

/* ═══ Legal — partner agreement key points ═══ */
.legal-points {
  grid-column: 1 / -1;
  list-style: none;
  margin: 4px 0 0;
  padding: 24px 0 0;
  border-top: 1px dashed var(--hairline);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 28px;
}
.legal-points li {
  display: flex;
  align-items: flex-start;
  align-self: stretch;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--fg-dim);
  min-height: 3em;
}
@media (max-width: 560px) {
  .legal-points li { min-height: 0; }
}
.legal-points li svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--brand-fg);
}
.legal-points li span { color: var(--fg); }
@media (max-width: 980px) {
  .legal-points { grid-template-columns: 1fr 1fr; gap: 14px 24px; }
}
@media (max-width: 560px) {
  .legal-points { grid-template-columns: 1fr; }
}
