/* Мои деньги: стили. Цвета и скругления взяты из палитры MBank (синий #0044CC, фон #F7F7F8, шрифт Inter). */
:root {
  --bg: #f7f7f8; --card: #ffffff; --text: #1c1c1e; --mute: #838795; --line: #eceff1;
  --accent: #0044cc; --link: #0044cc; --accent-soft: #d4e3ff; --on-accent: #ffffff;
  --good: #16a34a; --bad: #e5484d; --warn: #faad14; --field: #f4f6f7;
  --hero: linear-gradient(135deg, #0044cc 0%, #1a64f0 100%);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f11; --card: #18191c; --text: #f4f6f7; --mute: #838795; --line: #2f3137;
    --accent: #2d6cdf; --link: #5baaff; --accent-soft: #1d2a44; --good: #4ade80; --bad: #ff6b70; --warn: #fdd400; --field: #0e0f11;
    --hero: linear-gradient(135deg, #0a3aa8 0%, #1a5ae0 100%); --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text); padding-bottom: 92px;
  font: 400 16px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums;
}
body.lock { overflow: hidden; }
main { max-width: 640px; margin: 0 auto; padding: 16px; }
h2 { font-size: 13px; color: var(--mute); font-weight: 600; margin: 22px 4px 8px; letter-spacing: .01em; }
b { font-weight: 600; }
.click { cursor: pointer; }

/* карточки и строки */
.card { background: var(--card); border-radius: 20px; padding: 10px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.hero { background: var(--hero); color: #fff; padding: 22px 20px; border-radius: 24px; box-shadow: none; }
.hero .lbl { color: rgba(255, 255, 255, .78); font-size: 14px; font-weight: 500; }
.hero .big { font-size: 42px; font-weight: 700; margin: 6px 0 10px; letter-spacing: -.02em; color: #fff; }
.hero .big.neg { color: #ffd0d2; }
.hero .sub { color: rgba(255, 255, 255, .78); font-size: 14px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row .t b.wrap { white-space: normal; }
.row small { color: var(--mute); font-size: 13px; }
.right { text-align: right; flex: none; }
.dhead { display: block; margin-top: 8px; color: var(--mute); }
.hint { color: var(--mute); font-size: 13px; }
small.hint { display: block; margin-top: 6px; }
.bignum { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.pos { color: var(--good); } .neg { color: var(--bad); } .warn { color: var(--warn); }
.empty { color: var(--mute); text-align: center; padding: 18px; }
table { width: 100%; font-size: 13px; border-collapse: collapse; }
td, th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }

/* иконки */
.ic { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--link); display: flex; align-items: center; justify-content: center; flex: none; }
.ic svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.inl { width: 16px; height: 16px; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-right: 5px; }

/* кнопки */
button { font: inherit; font-weight: 600; border: 0; border-radius: 14px; padding: 13px 16px; background: var(--accent); color: var(--on-accent); cursor: pointer; transition: opacity .15s; }
button:active { opacity: .75; }
button.sec { background: var(--accent-soft); color: var(--link); }
button.sm { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
button.danger { background: var(--bad); color: #fff; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.actions.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions button { min-width: 0; padding: 13px 8px; font-size: 15px; line-height: 1.2; white-space: normal; overflow-wrap: break-word; text-align: center; min-height: 48px; }
.actions:not(.c3) button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.chip { padding: 8px 14px; border-radius: 999px; font-size: 14px; background: var(--field); color: var(--text); font-weight: 500; }
.chip.on { background: var(--accent); color: #fff; }

/* нижнее меню */
nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
nav button { flex: 1; background: none; color: var(--mute); border-radius: 12px; padding: 6px 0; font-size: 10.5px; font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 3px; }
nav button svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--link); }

/* поля ввода */
input, select { font: inherit; width: 100%; padding: 13px 14px; border: 1.5px solid transparent; border-radius: 14px; background: var(--field); color: var(--text); outline: 0; }
input:focus, select:focus { border-color: var(--accent); }
input.bad { border-color: var(--bad); }
.err { display: block; color: var(--bad); margin-top: 4px; font-size: 13px; }
input[type=checkbox] { width: auto; }
label { display: block; font-size: 13px; color: var(--mute); margin: 12px 0 5px; font-weight: 500; }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 16px; }
.prow { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.prow input[type=date] { flex: 1.3; } .prow input[type=text] { flex: 1; }
.seg { display: flex; gap: 6px; background: var(--field); border-radius: 14px; padding: 4px; }
.seg label { flex: 1; margin: 0; text-align: center; border-radius: 11px; padding: 9px; color: var(--mute); cursor: pointer; font-size: 15px; }
.seg label:has(input:checked) { background: var(--card); color: var(--link); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.seg input { display: none; }
.seg input:checked + span { font-weight: 600; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; font-weight: 400; background: var(--field); color: var(--text); border: 1.5px solid transparent; border-radius: 14px; padding: 13px 14px; }
.pick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick svg { width: 18px; height: 18px; stroke: var(--mute); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* диалоги и шторки */
.ov { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal { background: var(--card); width: 100%; max-width: 640px; border-radius: 24px 24px 0 0; padding: 10px 18px 22px; max-height: 92vh; overflow: auto; }
.modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.modal h3 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.msg { white-space: pre-line; color: var(--text); margin: 4px 0 8px; font-size: 16px; }
.sheet-list { max-height: 58vh; overflow: auto; margin: 8px 0 4px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); font-size: 17px; cursor: pointer; }
.opt:last-child { border-bottom: 0; }
.opt.on { color: var(--link); font-weight: 600; }
.opt i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.opt.on i { border: 6px solid var(--accent); }

/* лимиты и отчёт */
.prog { height: 8px; background: var(--field); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.prog > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.prog.warn > i { background: var(--warn); } .prog.over > i { background: var(--bad); }
.brow { padding: 12px 0; border-bottom: 1px solid var(--line); }
.brow:last-child { border-bottom: 0; }
.brow .top { display: flex; align-items: center; gap: 12px; }
.brow .t { flex: 1; min-width: 0; }
.brow .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--mute); }
.catrow { padding: 6px 0; }
.catrow .line { display: flex; justify-content: space-between; }
.bar { height: 8px; background: var(--accent); border-radius: 4px; margin-top: 6px; }
