:root {
  --bg: #0b0d14;
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f2f4fa;
  --muted: #8a90a6;
  --accent: #7c5cff;
  --accent-2: #22d3a6;
  --danger: #ff5c7a;
  --warn: #ffb547;
  --radius: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  overflow-x: hidden;
}
.hidden { display: none !important; }

.bg-glow {
  position: fixed; inset: -20% -20% auto -20%; height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(124, 92, 255, 0.35), transparent 70%),
    radial-gradient(35% 45% at 85% 20%, rgba(34, 211, 166, 0.22), transparent 70%);
  filter: blur(20px);
}

main { padding: 16px 16px calc(96px + var(--safe-bottom)); max-width: 560px; margin: 0 auto; }

/* --- loader --- */
.loader { display: grid; place-items: center; height: 70vh; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.1); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- header --- */
.header { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
.hello { color: var(--muted); font-size: 13px; }
.name { font-weight: 700; font-size: 18px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}

/* --- cards --- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 13px; }

.balance-card {
  position: relative; overflow: hidden; padding: 22px;
  background: linear-gradient(140deg, #6d4dff 0%, #4b2fd6 45%, #1b9f86 100%);
  border: none; box-shadow: 0 20px 50px -20px rgba(124, 92, 255, .6);
}
.balance-card::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.balance-label { font-size: 13px; opacity: .8; }
.balance-value { font-size: 38px; font-weight: 800; letter-spacing: -1px; margin: 6px 0 14px; }
.balance-value .cur { font-size: 24px; opacity: .8; margin-left: 4px; }
.balance-row { display: flex; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,.16); font-size: 12px; font-weight: 600;
}

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick button { padding: 16px; }

/* --- goal --- */
.goal-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress > div {
  height: 100%; border-radius: inherit; transition: width .8s cubic-bezier(.2,.8,.2,1);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* --- members --- */
.member { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.member + .member { border-top: 1px solid var(--border); }
.member .avatar { width: 34px; height: 34px; font-size: 13px; }
.member .grow { flex: 1; min-width: 0; }
.member .amt { font-weight: 700; }
.share { height: 4px; border-radius: 999px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.share > div { height: 100%; background: var(--accent-2); }

/* --- tx list --- */
.tx { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.tx + .tx { border-top: 1px solid var(--border); }
.tx-ico {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0;
  background: var(--card-strong);
}
.tx-ico.in { color: var(--accent-2); background: rgba(34,211,166,.12); }
.tx-ico.out { color: var(--danger); background: rgba(255,92,122,.12); }
.tx-ico.bonus { color: var(--warn); background: rgba(255,181,71,.12); }
.tx .grow { flex: 1; min-width: 0; }
.tx .title { font-weight: 600; }
.tx .meta { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .sum { font-weight: 700; text-align: right; white-space: nowrap; }
.tx .sum.in { color: var(--accent-2); }
.tx .status { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.tx.clickable { cursor: pointer; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; font-size: 14px; }

/* --- forms --- */
.page-title { font-size: 24px; font-weight: 800; margin: 6px 0 16px; letter-spacing: -.5px; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
input, textarea, select {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: rgba(255,255,255,.04); color: var(--text); font: inherit; outline: none; transition: border-color .2s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.amount-input { font-size: 28px; font-weight: 800; text-align: center; padding: 18px; }

.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 16px; }
.presets button {
  flex: 1; padding: 9px 0; border-radius: 12px; background: var(--card-strong); color: var(--text);
  border: 1px solid var(--border); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}

.methods { display: grid; gap: 10px; margin-bottom: 16px; }
.method {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--border); transition: all .2s;
}
.method.selected { border-color: var(--accent); background: rgba(124,92,255,.12); }
.method.disabled { opacity: .4; pointer-events: none; }
.method .m-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--card-strong); }
.method .grow { flex: 1; }
.method .m-title { font-weight: 700; }
.method .m-sub { color: var(--muted); font-size: 12px; }

.btn {
  width: 100%; padding: 15px; border: none; border-radius: 16px; font: inherit; font-weight: 700; font-size: 16px;
  color: #fff; background: linear-gradient(135deg, var(--accent), #5b3df0); cursor: pointer;
  transition: transform .1s, opacity .2s; box-shadow: 0 10px 30px -12px rgba(124,92,255,.8);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--card-strong); box-shadow: none; border: 1px solid var(--border); }
.btn.green { background: linear-gradient(135deg, #22d3a6, #13a383); box-shadow: 0 10px 30px -12px rgba(34,211,166,.7); }
.btn.danger { background: rgba(255,92,122,.15); color: var(--danger); box-shadow: none; }
.btn.sm { padding: 9px 14px; font-size: 13px; border-radius: 12px; width: auto; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.bonus-hint {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; margin-bottom: 16px;
  background: rgba(255,181,71,.1); color: var(--warn); font-size: 13px; font-weight: 600;
}

/* --- closed banner --- */
.closed {
  text-align: center; padding: 30px 20px;
  background: linear-gradient(180deg, rgba(255,92,122,.12), rgba(255,92,122,.03));
  border: 1px solid rgba(255,92,122,.25);
}
.closed .big { font-size: 44px; margin-bottom: 8px; }
.closed h3 { font-size: 18px; margin-bottom: 8px; }
.closed .reason {
  margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(0,0,0,.25);
  text-align: left; white-space: pre-wrap; line-height: 1.45;
}
.closed .reason b { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 4px; }

/* --- admin --- */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px; background: rgba(255,92,122,.35); transition: .25s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .25s;
}
.switch input:checked + .slider { background: var(--accent-2); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.state { font-size: 12px; font-weight: 700; }
.state.on { color: var(--accent-2); }
.state.off { color: var(--danger); }
.reason-box { margin-top: 12px; }

input[type=range] { padding: 0; height: 6px; -webkit-appearance: none; appearance: none; background: rgba(255,255,255,.1); border: none; border-radius: 999px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 4px rgba(255,181,71,.25); }
.bonus-value { font-size: 32px; font-weight: 800; color: var(--warn); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 4px; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--card-strong); color: var(--muted); }
.badge.pending { background: rgba(255,181,71,.15); color: var(--warn); }
.badge.active { background: rgba(34,211,166,.15); color: var(--accent-2); }
.badge.blocked { background: rgba(255,92,122,.15); color: var(--danger); }

.req { padding: 14px; border-radius: 16px; background: var(--card-strong); margin-bottom: 10px; }
.req .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.req .details { font-size: 13px; color: var(--muted); margin: 6px 0 12px; word-break: break-all; }

/* --- tabbar --- */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); max-width: 536px; margin: 0 auto;
  display: flex; padding: 6px; border-radius: 22px; z-index: 10;
  background: rgba(20, 22, 34, .85); border: 1px solid var(--border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border: none;
  background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; border-radius: 16px; cursor: pointer;
}
.tabbar button .ico { font-size: 18px; line-height: 1; }
.tabbar button.active { color: var(--text); background: rgba(124,92,255,.22); }

/* --- toast & sheet --- */
.toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, -150%); z-index: 50; max-width: 90%;
  padding: 12px 18px; border-radius: 14px; background: #1d2030; border: 1px solid var(--border); font-weight: 600; font-size: 14px;
  transition: transform .3s cubic-bezier(.2,.8,.2,1); box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255,92,122,.5); color: #ffb3c1; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 560px; margin: 0 auto;
  background: #151826; border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + var(--safe-bottom));
  border-top: 1px solid var(--border); animation: up .3s cubic-bezier(.2,.8,.2,1); max-height: 85vh; overflow-y: auto;
}
@keyframes up { from { transform: translateY(100%); } }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.copy-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 14px; border-radius: 14px;
  background: var(--card-strong); margin-bottom: 8px; cursor: pointer;
}
.copy-row .k { color: var(--muted); font-size: 12px; }
.copy-row .v { font-weight: 700; }

.center-screen { text-align: center; padding: 80px 20px; }
.center-screen .big { font-size: 56px; margin-bottom: 12px; }
.center-screen p { color: var(--muted); }

.fade-in { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
