* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Tahoma, "Vazirmatn", sans-serif;
  background: var(--tg-theme-bg-color, #f4f4f5);
  color: var(--tg-theme-text-color, #1c1c1e);
}

.hidden { display: none !important; }

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100vh;
  font-size: 14px;
  color: var(--tg-theme-hint-color, #8e8e93);
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(36, 129, 204, 0.2);
  border-top-color: var(--tg-theme-link-color, #2481cc);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  background: #ffdede;
  color: #a30000;
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 22, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(6px); }

#main { padding-bottom: 24px; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  background: linear-gradient(135deg, var(--tg-theme-button-color, #2481cc), #1b5f96);
  color: #fff;
}
.app-header-title { font-size: 17px; font-weight: bold; }
.app-header-balance {
  font-size: 12px;
  background: rgba(255,255,255,0.18);
  padding: 5px 12px;
  border-radius: 14px;
}

.tabbar {
  display: flex;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--tg-theme-bg-color, #f4f4f5);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  border: none;
  border-radius: 12px;
  background: var(--tg-theme-secondary-bg-color, #ffffff);
  font-size: 13px;
  color: var(--tg-theme-hint-color, #8e8e93);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-icon { font-size: 15px; }

.tab-btn.active {
  color: var(--tg-theme-button-text-color, #fff);
  background: var(--tg-theme-button-color, #2481cc);
  font-weight: bold;
}

.tab { display: none; padding: 14px 16px 4px; }
.tab.active { display: block; animation: fadein 0.18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--tg-theme-secondary-bg-color, #ffffff);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.card-title { font-weight: bold; margin-bottom: 6px; font-size: 14px; }
.card-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--tg-theme-hint-color, #8e8e93); padding: 3px 0; }
.card-row b { color: var(--tg-theme-text-color, #1c1c1e); font-weight: normal; }

.status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 10px;
  margin-inline-start: 6px;
  font-weight: normal;
}
.status-active { background: #d7f7dd; color: #16812c; }
.status-pending { background: #fff3cd; color: #8a6d00; }
.status-expired { background: #eeeeee; color: #666; }
.status-deleted { background: #ffdede; color: #a30000; }

.progress-bar {
  height: 9px;
  border-radius: 5px;
  background: #e6e6e6;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; }
.progress-fill.low { background: #16812c; }
.progress-fill.mid { background: #d99a00; }
.progress-fill.high { background: #c22a2a; }

.selectable-card {
  cursor: pointer;
  border: 2px solid transparent;
  position: relative;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.selectable-card:active { border-color: var(--tg-theme-link-color, #2481cc); transform: scale(0.98); }
.selectable-card::after {
  content: "‹";
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  color: var(--tg-theme-hint-color, #8e8e93);
  font-size: 20px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}
.primary-btn:disabled { opacity: 0.5; }
.primary-btn:active { opacity: 0.85; }

.copy-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: var(--tg-theme-bg-color, #f4f4f5);
  border-radius: 10px;
  padding: 8px 10px;
}
.copy-link-text {
  flex: 1;
  font-size: 11px;
  color: var(--tg-theme-hint-color, #8e8e93);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: left;
}
.copy-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:active { opacity: 0.8; }

.back-btn {
  border: none;
  background: none;
  color: var(--tg-theme-link-color, #2481cc);
  font-size: 13px;
  padding: 0 0 12px;
  cursor: pointer;
}

.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}
.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tg-theme-secondary-bg-color, #ffffff);
  color: var(--tg-theme-hint-color, #8e8e93);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid rgba(0,0,0,0.08);
}
.step-dot.active {
  background: var(--tg-theme-button-color, #2481cc);
  color: var(--tg-theme-button-text-color, #fff);
  border-color: var(--tg-theme-button-color, #2481cc);
}
.step-dot.done {
  background: #16812c;
  color: #fff;
  border-color: #16812c;
}
.step-line { width: 26px; height: 2px; background: rgba(0,0,0,0.1); }

.empty-state {
  text-align: center;
  color: var(--tg-theme-hint-color, #8e8e93);
  padding: 50px 0;
  font-size: 13px;
}
.empty-state-icon { font-size: 34px; display: block; margin-bottom: 10px; }

.wallet-hero { text-align: center; }
.balance-label { font-size: 13px; color: var(--tg-theme-hint-color, #8e8e93); }
.balance-amount { font-size: 24px; font-weight: bold; margin: 8px 0; color: var(--tg-theme-link-color, #2481cc); }
.hint { font-size: 12px; color: var(--tg-theme-hint-color, #8e8e93); margin-top: 8px; }

h2 { font-size: 14px; margin: 4px 0 12px; color: var(--tg-theme-hint-color, #8e8e93); font-weight: bold; }

.tx-amount-positive { color: #16812c; }
.tx-amount-negative { color: #a30000; }
