/* /assets/css/pages/payouts.css */

/* Фон/высота .content — глобально в style.css (min-height:100svh; height:auto). */
.payouts {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: auto;
  min-height: 0;
  flex: 1 0 auto;
}

.payouts__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.payouts__heading {
  min-width: 0;
}

.payouts__title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #161616;
  line-height: 1.2;
}

.payouts__lead {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: #666;
}

.payouts__header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.payouts__export-btn.btn--primary {
  width: auto;
  min-width: 180px;
  height: 48px;
  padding: 0 20px;
  font-size: 15px;
}

/* KPI */
.payouts__summary {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.payouts-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.payouts-kpi__item {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 16px 18px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.payouts-kpi__item--accent {
  background: linear-gradient(135deg, #2f2f2f 0%, #3a3a3a 100%);
  border-color: #2f2f2f;
}

.payouts-kpi__item--accent .payouts-kpi__label {
  color: rgba(255, 255, 255, 0.65);
}

.payouts-kpi__item--accent .payouts-kpi__value {
  color: #f0c48a;
}

.payouts-kpi__label {
  font-size: 13px;
  line-height: 1.3;
  color: #888;
}

.payouts-kpi__value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #161616;
  line-height: 1.2;
  word-break: break-word;
}

/* tabs */
.payouts-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: #ececec;
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}

.payouts-tabs__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #666;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.payouts-tabs__btn.is-active {
  background: #fff;
  color: #161616;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.payouts-tabs__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f0e2cf;
  color: #9c6230;
  font-size: 12px;
  font-weight: 700;
}

.payouts-tabs__btn:not(.is-active) .payouts-tabs__count {
  background: #ddd;
  color: #666;
}

/* views */
.payouts-view {
  display: none;
}

.payouts-view.is-visible {
  display: flex;
  flex-direction: column;
}

/* list cards */
.payouts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payouts-card {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 14px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 16px 20px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.payouts-card:hover {
  border-color: #cb9451;
  box-shadow: 0 8px 24px rgba(22, 22, 22, 0.06);
}

.payouts-card--loading {
  opacity: 0.7;
  pointer-events: none;
}

.payouts-card--pending {
  opacity: 0.95;
}

.payouts-card--incomplete {
  border-color: #f0c48a;
  background: #fffcf7;
}

.payouts-card--zero {
  opacity: 0.85;
}

.payouts-card__who {
  min-width: 0;
}

.payouts-card__name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #161616;
  line-height: 1.25;
}

.payouts-card__period {
  margin: 6px 0 0;
  font-size: 13px;
  color: #777;
  line-height: 1.35;
}

.payouts-card__period strong {
  color: #444;
  font-weight: 600;
}

.payouts-card__badge {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.payouts-card__badge--debt {
  background: #fde8e8;
  color: #b42318;
}

.payouts-card__badge--ok {
  background: #e8f7e8;
  color: #1f7a1f;
}

.payouts-card__badge--warn {
  background: #fff1d6;
  color: #9a6700;
}

.payouts-card__badge--muted {
  background: #f0f0f0;
  color: #666;
}

.payouts-card__money {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payouts-card__metric {
  min-width: 0;
}

.payouts-card__metric-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.payouts-card__metric-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  letter-spacing: -0.01em;
}

.payouts-card__metric-value--pay {
  color: #b42318;
  font-size: 18px;
}

.payouts-card__metric-value--muted {
  color: #999;
  font-weight: 500;
}

.payouts-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 160px;
}

.payouts-card__actions .btn {
  width: 100%;
  max-width: none;
  height: 40px;
  min-height: 40px;
  font-size: 14px !important;
  line-height: 38px;
  padding: 0 12px;
}

.payouts-card__actions .btn--ghost {
  max-width: none;
}

.payouts-card__hint {
  margin-top: 4px;
  font-size: 12px;
  color: #9a6700;
  line-height: 1.35;
}

.payouts-empty {
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 14px;
  padding: 48px 24px;
  text-align: center;
  color: #666;
}

.payouts-empty__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.payouts-empty__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #888;
}

.payouts-empty--error .payouts-empty__title {
  color: #b42318;
}

.payouts-empty__retry {
  margin-top: 16px;
}

/* partner detail */
.payouts-partner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.payouts-partner-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.payouts-partner-eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  color: #888;
}

.payouts-partner-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #161616;
  line-height: 1.2;
}

.payouts-partner-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.payouts-partner-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.payouts-partner-summary .payouts-kpi__item {
  min-height: 76px;
}

.payouts-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payouts-hcard {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 14px;
  padding: 18px 20px;
}

.payouts-hcard--incomplete {
  border-color: #f0c48a;
  background: #fffcf7;
}

.payouts-hcard__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.payouts-hcard__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #161616;
}

.payouts-hcard__sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: #777;
}

.payouts-hcard__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.payouts-hcard__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.payouts-hcard__actions .btn {
  width: auto;
  min-width: 140px;
  max-width: none;
  height: 36px;
  font-size: 14px !important;
  line-height: 34px;
}

.payouts-payments {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eee;
}

.payouts-payments__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.payouts-payment {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f7f7;
  margin-bottom: 8px;
  font-size: 14px;
}

.payouts-payment:last-child {
  margin-bottom: 0;
}

.payouts-payment__when {
  color: #555;
}

.payouts-payment__amount {
  font-weight: 600;
  color: #1f7a1f;
}

.payouts-payment__file a {
  color: #9c6230;
  text-decoration: underline;
}

.pdf_doc {
  text-decoration: underline;
  color: #9c6230;
}

.fmtMoney {
  color: #d32525;
}

/* modals */
.modal__text {
  margin: 0 0 24px;
}

.payouts-pay-meta {
  margin: -12px 0 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f7f7;
  font-size: 14px;
  line-height: 1.45;
  color: #555;
}

.payouts-modal .field input,
.payouts-modal .field textarea,
.payouts-modal .field select {
  max-width: none;
  width: 100%;
}

.field:nth-last-child(2) {
  margin-top: 10px;
}

.payouts-modal__field > span {
  display: inline-block;
  font-size: 14px;
  color: #666666;
}

.payouts-file {
  width: 100%;
  height: 60px;
  border: 1px solid #999999;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  cursor: pointer;
}

.payouts-file__name {
  font-size: 18px;
  color: #333333;
}

.payouts-file__icon {
  width: 18px;
  height: 18px;
  background-image: url("/assets/img/payouts/download.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.9;
}

.payouts-export-modal {
  width: min(980px, calc(100% - 2rem));
  max-width: none;
}

.payouts-export-note {
  margin: 0 0 12px;
  font-size: 14px;
  color: #666;
}

.payouts-export-modal__tableWrap {
  padding-top: 10px;
  max-height: 888px;
  overflow: auto;
}

.payouts-downloading-modal {
  width: 100%;
  height: 100%;
  max-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.payouts-downloading-modal__text {
  font-size: 18px;
  text-align: center;
  padding: 24px;
}

.payouts .btn--ghost {
  width: 100%;
  height: 33px;
  min-width: 0;
  max-width: 160px;
  max-height: 33px;
  padding: 0;
  line-height: 28px;
  font-size: 18px !important;
}

@media (max-width: 1100px) {
  .payouts-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payouts-card {
    grid-template-columns: 1fr;
  }

  .payouts-card__actions {
    flex-direction: row;
    min-width: 0;
  }

  .payouts-hcard__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payouts-partner-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .payouts__header {
    flex-direction: column;
  }

  .payouts__header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .payouts-card__money {
    grid-template-columns: 1fr;
  }

  .payouts-payment {
    grid-template-columns: 1fr;
  }
}
