:root {
  --bg: #eef5fa; --card: #ffffff; --text: #0f1f2c; --muted: #5f7385; --line: #dbe6ee;
  --brand: #0b5e8e; --brand-2: #1683b8; --brand-soft: #dbeefa;
  --plus: #15803d; --minus: #c2410c; --warn: #b45309; --warn-soft: #fef3c7; --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08131d; --card: #10212f; --text: #e6f0f7; --muted: #8fa6b8; --line: #1f3446;
    --brand: #38bdf8; --brand-2: #0ea5e9; --brand-soft: #0f3550;
    --plus: #4ade80; --minus: #fb923c; --warn: #fbbf24; --warn-soft: #3a2f10; --danger: #f87171;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.boot { padding: 40vh 16px; text-align: center; color: var(--muted); }

.wrap { max-width: 560px; margin: 0 auto; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  max-width: 560px; margin: 0 auto; }
.top h1 { font-size: 20px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sub { color: var(--muted); font-size: 13px; }
.back { border: 0; background: var(--card); width: 38px; height: 38px; border-radius: 12px; box-shadow: var(--shadow); font-size: 20px; }

.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.cash { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.cash h2 { color: rgba(255,255,255,.8); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.big small { font-size: 15px; font-weight: 600; opacity: .85; margin-left: 4px; }
.cash .row-cur + .row-cur { margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--plus); } .minus { color: var(--minus); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.act { border: 0; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 12px; display: flex;
  align-items: center; gap: 10px; font-weight: 600; font-size: 15px; text-align: left; }
.actions.three { grid-template-columns: repeat(3, 1fr); }
.actions.three .act { flex-direction: column; gap: 4px; padding: 12px 6px; font-size: 14px; text-align: center; }
.act .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.act.in .ic { background: #dcfce7; color: #15803d; }
.act.out .ic { background: #ffedd5; color: #c2410c; }
.act.ex .ic { background: #e0e7ff; color: #4338ca; }
.act.tr .ic { background: var(--brand-soft); color: var(--brand); }
.dot.exchange { background: #e0e7ff; color: #4338ca; }
.dot.bank { background: #fef3c7; color: #92400e; }
.bell { position: relative; display: grid; place-items: center; color: var(--text); }
.bell svg { width: 22px; height: 22px; }
.bell .cnt { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px;
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-weight: 700; }
button.card { border: 0; width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; color: inherit; }
.wait-card { border: 2px solid var(--warn) !important; justify-content: space-between; }
.rates-card { display: block !important; }
.rates { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 14px; }
.rates b { font-variant-numeric: tabular-nums; }
.bank-card .grow { flex: 1; }
.code { font-size: 44px; font-weight: 800; letter-spacing: .18em; text-align: center; padding: 14px 0; margin-bottom: 12px;
  border-radius: 16px; background: var(--brand-soft); color: var(--brand); font-variant-numeric: tabular-nums; }
.check { display: flex !important; gap: 10px; align-items: center; color: var(--text) !important; font-weight: 600; font-size: 15px !important; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.rep { width: 100%; border-collapse: collapse; font-size: 14px; }
.rep th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; padding: 2px 0 6px 8px; }
.rep td { padding: 6px 0; border-top: 1px solid var(--line); }
.rep td + td { text-align: right; padding-left: 8px; white-space: nowrap; }
.rep tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
.rep tr.fee td { color: var(--brand); font-weight: 600; }

.list { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%;
  background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .right { text-align: right; flex-shrink: 0; }
.dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 15px; }
.dot.in { background: #dcfce7; color: #15803d; } .dot.out { background: #ffedd5; color: #c2410c; }
.dot.transfer { background: var(--brand-soft); color: var(--brand); } .dot.adjust { background: #e5e7eb; color: #374151; }
.dot.client { background: var(--brand-soft); color: var(--brand); }
.struck .title, .struck .num { text-decoration: line-through; opacity: .6; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.rejected, .badge.cancelled { background: #fee2e2; color: #b91c1c; }
.badge.admin { background: var(--brand-soft); color: var(--brand); }

.pending-card { border: 2px solid var(--warn); }
.btns { display: flex; gap: 8px; margin-top: 10px; }
.btn { border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 600; background: var(--brand); color: #fff; flex: 1; }
.btn:disabled { opacity: .5; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 14px; flex: 0 0 auto; }
.btn.block { width: 100%; display: block; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 0; }

.search { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); margin-bottom: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.chips select { padding: 8px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs .in { display: flex; width: 100%; max-width: 560px; }
.tab { flex: 1; border: 0; background: none; padding: 8px 0 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; gap: 2px; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--brand); font-weight: 600; }
.tab .cnt { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px;
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-weight: 700; }

/* формы */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.amount { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; min-height: 18px; }
.err { color: var(--danger); font-size: 14px; margin: 8px 0; min-height: 0; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; border: 1px solid var(--line); }
.seg button { flex: 1; min-width: 0; overflow-wrap: anywhere; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg.type button.on[data-v="in"] { color: #15803d; } .seg.type button.on[data-v="out"] { color: #c2410c; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); }
.picked .grow { flex: 1; min-width: 0; }
.drop { border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; max-height: 240px; overflow-y: auto; background: var(--card); }
.drop .item { padding: 10px 12px; }

/* нижний лист */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--card); border-radius: 20px 20px 0 0;
  max-height: 92vh; overflow-y: auto; overflow-x: hidden; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto;
  animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; margin-bottom: 12px; }
.sheet-head h3 { margin: 0; font-size: 18px; flex: 1; }
.x { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }

.login { max-width: 380px; margin: 0 auto; padding: 12vh 16px 24px; }
.logo { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  display: grid; place-items: center; font-size: 32px; font-weight: 700; margin-bottom: 16px; }
.login h1 { margin: 0 0 4px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { text-align: right; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 4px 8px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; }
.section-title .link { text-transform: none; letter-spacing: 0; font-size: 14px; }

/* ---------- AQUASCAPE: экран входа ---------- */
.cash { background: linear-gradient(135deg, #0a3558, #0b5e8e 55%, #1683b8); }
.lock { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; gap: 18px; }
.lock-logo { width: 100%; display: flex; justify-content: center; }
.lock-logo .logo-link { width: min(380px, 96vw); }
.lock-form, .lock .card { width: 100%; }
.logo-link { display: block; line-height: 0; border-radius: 16px; }
.logo-link img { width: 100%; height: auto; display: block; }
/* в тёмной теме тёмно-синие буквы логотипа сливаются с фоном — кладём его на белую плашку */
@media (prefers-color-scheme: dark) { .logo-link { background: #ffffff; padding: 10px 12px; border-radius: 20px; } }
.logo-link:active { transform: scale(.98); }
.logo-link.small { width: 210px; margin: 0 auto 12px; }
.phone { display: flex; align-items: stretch; }
.phone span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px;
  background: var(--card); color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.phone .input { border-radius: 0 12px 12px 0; font-size: 20px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.invite-url { word-break: break-all; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--line); font-size: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  margin: 4px auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { padding-top: 6vh; }
