* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: var(--tg-theme-bg-color, #1c1c1e);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #2c2c2e);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #0a84ff);
  --button: var(--tg-theme-button-color, #0a84ff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 32px;
}

.header {
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header h1 { font-size: 20px; font-weight: 700; }

.back-btn {
  background: none; border: none;
  color: var(--link); font-size: 16px;
  cursor: pointer; padding: 0;
}

.section { padding: 0 16px; margin-bottom: 20px; }

.section-title {
  font-size: 13px; color: var(--hint);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; padding: 0 4px;
}

/* Nav cards */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card {
  background: var(--secondary-bg); border-radius: 16px;
  padding: 20px 16px; cursor: pointer;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity 0.15s;
}
.card:active { opacity: 0.65; }
.card-icon { font-size: 30px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-desc { font-size: 13px; color: var(--hint); }

/* Forms */
.form-group {
  background: var(--secondary-bg);
  border-radius: 14px; overflow: hidden; margin-bottom: 10px;
}
.form-row {
  display: flex; align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(128,128,128,0.12);
}
.form-row:last-child { border-bottom: none; }
.form-label { font-size: 15px; color: var(--hint); min-width: 110px; }
.form-input, .form-select {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px; text-align: right;
}
.form-input::placeholder { color: var(--hint); }
.form-select { cursor: pointer; -webkit-appearance: none; }
.form-select option { background: #2c2c2e; color: #fff; }

/* Stats */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.stat-card {
  background: var(--secondary-bg); border-radius: 16px; padding: 16px;
  margin-bottom: 12px;
}
.stat-value { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--hint); }

.positive { color: #30d158; }
.negative { color: #ff453a; }

/* Progress */
.progress-bar {
  height: 5px; background: rgba(128,128,128,0.2);
  border-radius: 3px; overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--button); transition: width 0.6s ease;
}
.progress-fill.danger { background: #ff453a; }

/* List */
.list-item {
  background: var(--secondary-bg); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: opacity 0.15s;
}
.list-item:active { opacity: 0.65; }
.item-title { font-size: 15px; font-weight: 600; }
.item-sub { font-size: 13px; color: var(--hint); margin-top: 2px; }
.item-amount { font-size: 16px; font-weight: 600; text-align: right; }
.item-amount-sub { font-size: 12px; color: var(--hint); margin-top: 2px; text-align: right; }

/* Button */
.btn {
  display: block; width: 100%; padding: 16px;
  background: var(--button); color: var(--button-text);
  border: none; border-radius: 14px;
  font-size: 17px; font-weight: 600;
  cursor: pointer; margin-top: 16px;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.loading { text-align: center; color: var(--hint); padding: 48px 20px; font-size: 15px; }
