:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #7d8b99);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --button: var(--tg-theme-button-color, #5288c1);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #232e3c);
}

* { box-sizing: border-box; }

button { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--card);
  object-fit: cover;
}

.username {
  font-weight: 600;
  font-size: 16px;
}

.userid {
  font-size: 12px;
  color: var(--hint);
}

.balance-card, .deposit-card, .history-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.balance-label {
  color: var(--hint);
  font-size: 13px;
}

.balance-value {
  font-size: 32px;
  font-weight: 700;
  margin: 4px 0;
}

.balance-currency {
  color: var(--hint);
  font-size: 13px;
}

.deposit-card h3, .history-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 4px;
}

.field select,
.field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg);
  color: var(--text);
  font-size: 16px; /* 16px+ — iOS не зумит страницу при фокусе */
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-secondary {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--button);
  color: var(--link);
  text-decoration: none;
  font-size: 14px;
}

.btn-text {
  display: block;
  margin: 8px auto 0;
  background: none;
  border: none;
  color: var(--hint);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.invoice-status {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 14px;
}

.error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}

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

.history-list .empty {
  color: var(--hint);
  justify-content: center;
}

.status-paid { color: #4cd964; }
.status-active { color: #f5c542; }
.status-expired { color: #ff6b6b; }
