:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: #e0533d;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--secondary-bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}

#view {
  padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
}

h1 { font-size: 22px; font-weight: 700; margin: 4px 0 16px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.err { color: var(--danger); font-size: 14px; min-height: 18px; margin-top: 8px; }

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

.card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}

.card.row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.card.row:active { background: var(--secondary-bg); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .chev { color: var(--hint); font-size: 22px; }

.badge { font-size: 18px; }
.badge.big { font-size: 22px; margin-right: 8px; }

.stat .balance { font-size: 20px; font-weight: 700; }
.section { font-weight: 600; margin-bottom: 8px; }
.op { padding: 6px 0; border-top: 1px solid var(--secondary-bg); font-size: 15px; }
.op:first-of-type { border-top: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field .label { font-size: 14px; color: var(--hint); padding-left: 4px; }
.input {
  background: var(--bg);
  border: 1px solid var(--secondary-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  width: 100%;
}
.input:focus { outline: 2px solid var(--link); border-color: transparent; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font: inherit;
  font-weight: 600;
  background: var(--bg);
  color: var(--link);
  cursor: pointer;
}
.btn:active { opacity: .7; }
.btn.primary { background: var(--button); color: var(--button-text); }
.btn.danger { color: var(--danger); }

.center { text-align: center; padding: 40px 0; color: var(--hint); }

#tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--secondary-bg);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar button {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--hint);
  cursor: pointer;
}
#tabbar button .ic { font-size: 20px; filter: grayscale(1); opacity: .6; }
#tabbar button.active { color: var(--link); }
#tabbar button.active .ic { filter: none; opacity: 1; }
