@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Montserrat:wght@500;600;700&display=swap');

/* Reuse base assumptions from global/unsubscribe styles */
.payments-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0; /* предотвращает сжатие grid */
}

.payments-wrapper h1 {
  font-size: 32px;
  margin-bottom: 30px;
  text-align: left;
}

.history-panel {
  background: #FFFFFF;
  border: 1px solid #fff;
  border-radius: 16px;
  padding: 0 0 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;          /* добавлено */
  box-sizing: border-box;
}

.history-header-row, .history-row {
  display: grid;
  /* было: grid-template-columns: 140px 1fr 120px 120px; */
  grid-template-columns: repeat(4, 1fr);
  border-radius: 16px;
  border: 1px solid #fff;
  gap: 24px;
  align-items: center;
  align-items: center;
  justify-items: center; /* центр содержимого в ячейках */
  text-align: center;

  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 500;
}

.history-header-row {
  background: #E3F4FE;
  font-size: 14px;
  font-weight: 600;
  color: #202020;
  border-bottom: 1px solid #eee;
  padding: 12px 0;
  width: 100%;
  min-height: 64px;
  align-items: stretch;
}

.history-header-row > div {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.history-row {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  padding: 10px 0;
  border-bottom: 1px solid #f2f2f2;
}

.history-row:last-child { border-bottom: none; }

.status-pill {
  padding: 6px 12px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: #e9e9e9;
  color: #333;
}
.status-pill.completed { background: #d6f6e3; color: #0a7a41; }
.status-pill.pending { background: #fff4cc; color: #9a7a00; }
.status-pill.failed { background: #ffe2e0; color: #b01818; }

.empty-placeholder {
  text-align: center;
  color: #777;
  font-size: 14px;
  padding: 20px 0;
  font-family: 'Montserrat', sans-serif;
}

.history-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}

.refresh-btn {
  background: rgba(0, 158, 255, 1);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .3s ease;
}
.refresh-btn:hover { background:#0477b5; }

.loading-inline { font-size: 14px; color:#666; }

.success {
    background-color: #00B300;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
}

.error {
    background-color: #FF0000;
}

/* Mobile */
@media (max-width: 900px) {
  .history-header-row { display: none; }
  .history-row {
    grid-template-columns: 1fr 90px; /* main + status */
    gap: 8px;
    font-size: 13px;
    border: 1px solid #f0f0f0;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    background: #fbfbfb;
  }
  .history-row > .date { order: 0; font-weight:600; color:#202020; }
  .history-row > .tariff { order: 1; }
  .history-row > .amount { order: 2; font-weight:600; }
  .history-row > .status { order: 3; justify-self: flex-end; }
  .history-panel { padding: 20px; }
  .payments-wrapper h1 { font-size: 28px; text-align:center; }
  .history-actions { justify-content: center; }
}

@media (max-width: 480px) {
  .payments-wrapper h1 { font-size: 24px; }
  .history-panel { padding:16px; }
  .history-row { gap:6px; }
}

/* Ultra-mobile stacked layout with inline labels */
@media (max-width: 600px) {
  .history-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    grid-template-columns: none;
  }
  .history-row > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0;
    font-size: 14px;
  }
  .history-row > div.status { justify-content: flex-start; }
  .history-row > div::before {
    content: attr(data-label);
    font-weight: 600;
    color: #202020;
    margin-right: 8px;
    font-size: 13px;
  }
  .history-row .status-pill { font-size: 11px; }
}
