@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url(/fonts/ploni-200.woff2) format('woff2');
}
@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/fonts/ploni-300.woff2) format('woff2');
}
@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/ploni-400.woff2) format('woff2');
}
@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/ploni-500.woff2) format('woff2');
}
@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/ploni-600.woff2) format('woff2');
}
@font-face {
  font-family: 'Ploni';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/ploni-700.woff2) format('woff2');
}

/* ---------- основа ---------- */
:root {
  /* шрифт приложения: Ploni (латиница, кириллица, иврит), файлы в /fonts */
  --font: 'Ploni', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --ink: #0f1417;
  --muted: #8c949b;
  --bg: #f2f4f5;
  --card: #ffffff;
  --soft: #f4f6f7;
  --line: #e8ecee;
  --teal: #0b5d65;
  --teal-2: #1a90a8;
  --green: #12c27a;
  --orange: #f59a0e;
  --pink: #e0456b;
  --neg: #d4540a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: #c9cdd1; -webkit-text-size-adjust: 100%; color-scheme: light; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 12px; line-height: 1.4; font-weight: 400; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.page { max-width: 420px; margin: 0 auto; background: var(--bg); min-height: 100vh; position: relative; overflow: clip; padding-bottom: 94px; }
@media (min-width: 403px) {
  .page { margin: 17px auto; min-height: calc(100vh - 35px); border-radius: 32px; box-shadow: 0 22px 58px rgba(20, 30, 40, .22); }
}

/* ---------- верхняя панель ---------- */
.top { background: #fff; border-radius: 0 0 29px 29px; padding: 0 14px 16px; }
.top:empty { display: none; }
.appbar { position: sticky; top: 0; z-index: 25; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; padding: max(13px, env(safe-area-inset-top)) 14px 6px; min-height: 58px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: box-shadow .15s; }
.appbar.scrolled { box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(20, 30, 40, .06); }
.appbar .title { font-size: 17px; font-weight: 400; letter-spacing: -0.02em; text-align: center; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .l { justify-self: start; display: flex; gap: 6px; }
.appbar .r { justify-self: end; display: flex; gap: 6px; }
.rbtn {
  width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; flex: none; cursor: pointer; border: 0;
  background: var(--soft); color: var(--ink); position: relative; padding: 0;
}
.rbtn svg { width: 15px; height: 15px; }
.rbtn.black { background: #0b0b0b; color: #fff; }
.rbtn.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.rbtn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px var(--soft); }
[dir="rtl"] .rbtn.flip svg { transform: scaleX(-1); }
.avatar-btn { width: 33px; height: 33px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: 13px; flex: none; background: linear-gradient(135deg, var(--teal-2), var(--teal)); }

/* ---------- баланс ---------- */
.balance { text-align: center; padding: 19px 0 4px; }
.balance .label { font-size: 14px; color: var(--muted); font-weight: 300; }
.amount { display: inline-flex; align-items: flex-start; justify-content: center; gap: 3px; margin: 4px 0 2px; direction: ltr; }
.amount sup { font-size: 22px; line-height: 1; margin-top: 9px; color: var(--muted); font-weight: 300; vertical-align: baseline; }
.amount .num { font-size: clamp(40px, 13.0vw, 55px); line-height: 1.05; font-weight: 400; letter-spacing: -0.045em; }
.amount .sign { font-size: clamp(29px, 8.6vw, 37px); line-height: 1.15; font-weight: 300; margin-inline-end: 2px; align-self: flex-start; margin-top: 3px; }
.amount.neg .num, .amount.neg .sign { color: var(--neg); }
.note { display: inline-block; text-align: center; line-height: 1.3; background: #eef3f4; color: var(--teal); border-radius: 10px; padding: 6px 10px; font-size: 13px; margin-top: 7px; font-weight: 400; }
.note.muted { color: var(--muted); }
.note b { font-weight: 500; }

/* ---------- поиск ---------- */
.searchrow { display: flex; gap: 7px; margin-top: 16px; align-items: center; }
.searchbar { flex: 1; min-width: 0; height: 42px; border-radius: 719px; background: var(--soft); display: flex; align-items: center; padding: 0 14px; gap: 7px; }
.searchbar input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13px; height: 100%; padding: 0; }
.searchbar input::placeholder { color: var(--muted); }
.searchbar svg { width: 16px; height: 16px; color: var(--ink); flex: none; }
.searchrow .rbtn { width: 42px; height: 42px; }
.searchrow .rbtn svg { width: 17px; height: 17px; }

/* ---------- график ---------- */
.chart { position: relative; margin: 4px -14px -16px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .months { display: flex; justify-content: space-between; padding: 6px 16px 16px; color: var(--muted); font-size: 12px; font-weight: 300; }
.chart .months .on { color: var(--ink); font-weight: 400; }
.tip { position: absolute; background: var(--teal); color: #fff; border-radius: 12px; padding: 9px 12px; min-width: 92px; pointer-events: none; transform: translate(-100%, -50%); margin-left: -10px; white-space: nowrap; z-index: 2; }
.tip::after { content: ""; position: absolute; top: 50%; inset-inline-end: -5px; width: 10px; height: 10px; background: var(--teal); transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
.tip.flip { transform: translate(0, -50%); margin-left: 10px; }
.tip.flip::after { inset-inline-end: auto; inset-inline-start: -5px; }
.tip .v { font-size: 14px; font-weight: 400; letter-spacing: -0.02em; direction: ltr; text-align: start; }
.tip .d { font-size: 12px; font-weight: 300; margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, .22); opacity: .95; }
.chart-empty { text-align: center; color: var(--muted); padding: 29px 0 7px; font-weight: 300; }

/* ---------- карточки ---------- */
.stack { padding: 12px 12px 0; }
.card { background: var(--card); border-radius: 26px; padding: 16px 14px; margin-bottom: 10px; }
.card .head { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-bottom: 6px; }
.card .head h2 { font-size: 20px; font-weight: 400; letter-spacing: -0.03em; margin: 0; }
.card.empty { text-align: center; color: var(--muted); padding: 26px 14px; font-weight: 300; }
.pill-btn { display: inline-flex; align-items: center; gap: 4px; height: 33px; padding: 0 14px; border-radius: 719px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; cursor: pointer; border: 0; color: var(--ink); white-space: nowrap; }
.pill-btn svg { width: 13px; height: 13px; }
.bignum { display: flex; align-items: center; gap: 9px; margin: 3px 0 12px; direction: ltr; justify-content: flex-start; }
[dir="rtl"] .bignum { justify-content: flex-end; }
.bignum .n { font-size: 33px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; }
.bignum .t { font-size: 12px; color: var(--ink); max-width: 7em; line-height: 1.15; font-weight: 300; direction: inherit; }

/* строки «обзора» с цветной иконкой и мини-графиком */
.orow { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.orow:last-child { border-bottom: 0; }
.sqicon { width: 37px; height: 37px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; font-size: 14px; font-weight: 500; }
.sqicon svg { width: 17px; height: 17px; }
.orow .main { flex: 1; min-width: 0; }
.orow .lab { font-size: 12px; color: var(--muted); font-weight: 300; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orow .val { font-size: 19px; letter-spacing: -0.03em; line-height: 1.15; }
.orow .val.neg { color: var(--neg); }
.spark { width: 66px; height: 27px; flex: none; }

/* строки целей с полосой прогресса */
.grow-row { padding: 10px 0 7px; }
.grow-row .line1 { display: flex; justify-content: space-between; align-items: baseline; gap: 7px; font-size: 15px; letter-spacing: -0.02em; }
.grow-row .line2 { display: flex; justify-content: space-between; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 300; margin-top: 2px; }
.track { height: 5px; border-radius: 3px; background: #e6ecee; margin-top: 9px; overflow: hidden; position: relative; }
.track > i { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; border-radius: 3px; background: var(--teal); }
.track > i.n { background: var(--orange); }
.v-pos { color: var(--ink); }
.v-neg { color: var(--neg); }
.dir { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* мягкие строки внутри карточки (как «Upcoming») */
.item { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 19px; padding: 9px 13px 9px 9px; margin-bottom: 7px; }
[dir="rtl"] .item { padding: 9px 9px 9px 13px; }
.item.click { cursor: pointer; }
.item.click:active { transform: scale(.992); }
.item .sq { width: 36px; height: 36px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none; color: var(--teal); }
.item .sq svg { width: 16px; height: 16px; }
.item .main { flex: 1; min-width: 0; }
.item .t1 { font-size: 14px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .t2 { font-size: 12px; color: var(--muted); font-weight: 300; }
.item .side { text-align: end; white-space: nowrap; }
.item .side .a { font-size: 14px; }
.item .side .b { font-size: 12px; color: var(--muted); font-weight: 300; }
.dchip { width: 36px; height: 39px; border-radius: 12px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; line-height: 1.1; }
.dchip .d { font-size: 15px; letter-spacing: -0.03em; }
.dchip .m { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 300; }
.month { font-size: 12px; color: var(--muted); padding: 10px 3px 7px; font-weight: 300; }
.avrow { display: flex; align-items: center; margin: 10px 0 0; justify-content: center; }
.avrow .ava { width: 29px; height: 29px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-weight: 500; font-size: 12px; color: #fff; margin-inline-end: -7px; }
.avrow .plus { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); margin-inline-start: 4px; border: 0; cursor: pointer; }
.avrow .plus svg { width: 13px; height: 13px; }

/* ---------- формы ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin: 13px 0 6px; font-weight: 300; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 16px; border: 1.5px solid transparent; background: var(--soft); outline: none;
  transition: border-color .12s; appearance: none; -webkit-appearance: none; font-size: 13px;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 19px) 19px, calc(100% - 15px) 19px; background-size: 4px 4px; background-repeat: no-repeat; padding-inline-end: 32px; }
[dir="rtl"] select { background-position: 19px 19px, 15px 19px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); background: #fff; }
textarea { height: auto; min-height: 69px; padding: 12px 14px; resize: vertical; }
.amount-input { height: auto !important; font-size: clamp(37px, 12.2vw, 52px); font-weight: 400; text-align: center; padding: 4px 0 9px !important; letter-spacing: -0.045em; border: 0 !important; border-bottom: 1.5px solid var(--line) !important; border-radius: 0 !important; background: none !important; }
.amount-input:focus { border-bottom-color: var(--teal) !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 20px; border-radius: 719px; border: 0;
  background: var(--teal); color: #fff; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform .08s, opacity .12s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.block { display: flex; width: 100%; }
.btn.black { background: #0b0b0b; }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.line { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.btn.danger { background: transparent; box-shadow: inset 0 0 0 1px rgba(212, 84, 10, .4); color: var(--neg); }
.btn.small { height: 29px; padding: 0 13px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 0; }
.actions .btn { flex: 1; min-width: 0; padding: 0 12px; }
.error { background: #fff1ea; color: var(--neg); padding: 10px 12px; border-radius: 14px; margin: 12px 0 0; font-size: 12px; }
.error[hidden] { display: none; }
.stackform .card { padding-top: 17px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 0; background: var(--soft); height: 30px; padding: 0 13px; border-radius: 719px; cursor: pointer; font-size: 12px; color: var(--ink); }
.seg button.on { background: var(--teal); color: #fff; }
.split-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.split-row:last-child { border-bottom: 0; }
.split-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row input[type=text] { width: 86px; height: 33px; text-align: end; border-radius: 12px; font-size: 13px; }
.split-row input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--teal); flex: none; }
.split-row .calc { min-width: 63px; text-align: end; color: var(--muted); font-size: 12px; font-weight: 300; }
.hint { font-size: 12px; margin-top: 7px; color: var(--muted); }
.hint.bad { color: var(--neg); }
.hint.good { color: var(--teal); }
.invite { display: flex; gap: 6px; }
.invite input { flex: 1 1 0; min-width: 0; font-size: 12px; }
.swatches { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 3px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; outline: 0; position: relative; }
.swatches button.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ink); }

/* ---------- нижняя панель ---------- */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; display: flex; align-items: center; gap: 7px; width: max-content; max-width: calc(100vw - 17px); }
.nav .act { display: inline-flex; align-items: center; gap: 6px; height: 45px; padding: 0 17px 0 14px; white-space: nowrap; border-radius: 719px; background: var(--teal); color: #fff; font-size: 13px; box-shadow: 0 7px 20px rgba(11, 93, 101, .35); }
.nav .act svg { width: 16px; height: 16px; }
.nav .pill { display: flex; gap: 3px; padding: 4px; border-radius: 719px; background: rgba(120, 128, 134, .72); backdrop-filter: blur(13px) saturate(150%); -webkit-backdrop-filter: blur(13px) saturate(150%); box-shadow: 0 7px 20px rgba(20, 30, 40, .22); }
.nav .pill a { width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.nav .pill a svg { width: 17px; height: 17px; }
.nav .pill a.on { background: #fff; color: var(--teal); box-shadow: 0 3px 9px rgba(0, 0, 0, .12); }

/* ---------- окна и уведомления ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 20, 23, .45); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { background: #fff; width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 19px 14px 24px; }
@media (min-width: 403px) { .overlay { align-items: center; } .sheet { border-radius: 26px; } }
.sheet h1 { font-size: 22px; font-weight: 400; letter-spacing: -0.03em; margin: 4px 0 0; }
.sheet .card { background: var(--soft); border-radius: 19px; padding: 10px 13px; }
.kicker { font-size: 12px; color: var(--muted); font-weight: 300; }
.big { font-size: clamp(35px, 10.8vw, 46px); line-height: 1; font-weight: 400; letter-spacing: -0.045em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.toast { position: fixed; inset-inline: 14px; bottom: 79px; margin: 0 auto; max-width: 302px; background: #0b0b0b; color: #fff; padding: 12px 16px; border-radius: 719px; display: flex; align-items: center; gap: 9px; z-index: 60; font-size: 12px; }
.toast button { background: none; border: 0; color: #7fe3d0; cursor: pointer; margin-inline-start: auto; font-size: 12px; }

/* ---------- вход ---------- */
.plain { background: #fff; min-height: 100vh; }
.authhead { padding: 39px 17px 6px; text-align: center; }
.authhead img { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 16px; }
.authhead h1 { font-size: 32px; font-weight: 300; letter-spacing: -0.04em; margin: 0 0 6px; }
.authhead p { margin: 0 auto; font-size: 14px; color: var(--muted); max-width: 18em; font-weight: 300; line-height: 1.3; }
.authbody { padding: 13px 17px 29px; }
.langs { display: flex; gap: 14px; margin: 20px 0 0; justify-content: center; }
.langs button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.langs button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.empty { text-align: center; color: var(--muted); padding: 20px 9px; }
.spinner { text-align: center; color: var(--muted); padding: 58px 0; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .btn { transition: none; } }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea { font-size: 16px; }
.searchbar input, .split-row input[type=text] { font-size: 16px; }
.amount-input { font-size: clamp(38px, 12vw, 52px) !important; }

/* выбор валюты и курс */
.amtrow { display: flex; gap: 8px; align-items: flex-end; }
.amtrow select { width: auto; min-width: 66px; flex: none; height: 41px; padding: 0 28px 0 12px; background-position: calc(100% - 14px) 18px, calc(100% - 10px) 18px; font-size: 14px; }
[dir="rtl"] .amtrow select { padding: 0 12px 0 28px; background-position: 14px 18px, 10px 18px; }
.amtrow .amount-input { flex: 1; min-width: 0; width: auto; }
.conv { background: var(--soft); border-radius: 18px; padding: 10px 12px; margin-top: 10px; }
.conv[hidden] { display: none; }
.conv-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.conv-row input { width: 78px; height: 32px; padding: 0 8px; text-align: center; border-radius: 12px; background: #fff; font-size: 16px; }
.conv-total { font-size: 17px; color: var(--teal); margin-top: 6px; }
.conv-msg { font-size: 12px; color: var(--muted); min-height: 0; }
.conv-src { display: inline-block; font-size: 11px; color: var(--muted); margin-top: 4px; text-decoration: underline; }

/* итог расхода до сохранения */
.result { margin-top: 10px; background: var(--soft); border-radius: 16px; padding: 4px 12px; }
.result:empty { display: none; }
.result > div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.result > div:last-child { border-bottom: 0; }
.result .up span:last-child { color: var(--teal); }
.result .down span:last-child { color: var(--neg); }

/* кто кому должен в списке групп */
.orow .debts { font-size: 12px; line-height: 1.3; color: var(--muted); margin-top: 2px; }
.orow .debts.in { color: var(--teal); }
.orow .debts.out { color: var(--neg); }

/* отступы между полями на экране входа */
.authbody form > div { margin-bottom: 14px; }

/* админ-панель */
.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.stat { background: var(--soft); border-radius: 18px; padding: 10px 12px; }
.stat .n { font-size: 26px; letter-spacing: -0.03em; line-height: 1.1; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 300; }
.badge { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); margin-inline-start: 6px; vertical-align: middle; }
.badge.bad { background: #fff1ea; color: var(--neg); }
.badge.ok { background: #e4f3f1; color: var(--teal); }
.mono { font-family: ui-monospace, Menlo, monospace; }
