/* Мої фінанси — той самий дизайн «Диспетчерська», що й у Logen CRM / Content Machine. */
@font-face { font-family: 'Geist'; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-cyrillic-wght-normal.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Geist'; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-cyrillic-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Geist'; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-weight: 100 900; font-display: swap; src: url('../fonts/geist-mono-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF; }

:root, :root[data-theme='dark'] {
  --bg: #0b131a; --side: #0b131a; --surface: #121a22; --surface-2: #161f28; --sunk: #0e161d; --field: #0e161d;
  --line: #1c2630; --line-2: #27323e; --line-ctl: #3b4a5a;
  --text: #e4e9ef; --text-strong: #f5f7fa; --soft: #c4ccd6; --muted: #9eabb9; --faint: #7a8897;
  --accent: #2f7be6; --accent-hover: #4a8ff0; --accent-ink: #fff; --accent-text: #6aa6f5; --accent-bg: rgb(47 123 230 / .15); --accent-line: rgb(47 123 230 / .5);
  --ok: #3ad69e; --ok-bg: rgb(54 211 153 / .13); --lamp-ok: #36d399;
  --run: #f5c443; --run-bg: rgb(245 196 67 / .14); --run-line: rgb(245 196 67 / .4);
  --err: #ff7272; --err-bg: rgb(255 106 106 / .13); --err-line: rgb(255 106 106 / .4);
  --plate: #1d76e1; --plate-ink: #fff; --hover: #1b232c; --series-2: #6c7e93;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #f1f4f8; --side: #ffffff; --surface: #ffffff; --surface-2: #f7f9fc; --sunk: #f3f6f9; --field: #ffffff;
  --line: #e1e7ee; --line-2: #cbd5e1; --line-ctl: #9fb0c4;
  --text: #0e1621; --text-strong: #070c14; --soft: #2f3d50; --muted: #44546a; --faint: #5b6b7f;
  --accent: #1d6fdc; --accent-hover: #185fc0; --accent-ink: #fff; --accent-text: #1762c8; --accent-bg: rgb(29 111 220 / .09); --accent-line: rgb(29 111 220 / .38);
  --ok: #0b7f55; --ok-bg: rgb(11 135 90 / .1); --lamp-ok: #12a06b;
  --run: #8a5a00; --run-bg: rgb(245 196 67 / .25); --run-line: rgb(233 167 0 / .45);
  --err: #c42d2d; --err-bg: rgb(198 47 47 / .08); --err-line: rgb(198 47 47 / .3);
  --plate: #1d6fdc; --plate-ink: #fff; --hover: #f2f6fb; --series-2: #8a9bb3;
  color-scheme: light;
}
:root { --font: 'Geist', 'Segoe UI', system-ui, sans-serif; --mono: 'Geist Mono', Consolas, monospace; --radius-s: 6px; --radius: 8px; --ctl: 36px; --pad: 14px; --gap: 14px; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0; color: var(--text-strong); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--text-strong); }
.ok { color: var(--ok); } .err { color: var(--err); } .warn-t { color: var(--run); }
.nowrap { white-space: nowrap; }
.ic { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* верхня смуга */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 16px; background: var(--side); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 14px; color: var(--text-strong); font-weight: 600; text-decoration: none !important; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--plate); color: var(--plate-ink); font: 700 16px/1 var(--font); }
.logo.big { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; margin: 0 auto 12px; }
.tabs { display: flex; gap: 2px; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border-radius: 7px; color: var(--muted); font-size: 13.5px; text-decoration: none !important; }
.tab:hover { background: var(--surface); color: var(--text); }
.tab.on { background: var(--accent-bg); color: var(--accent-text); font-weight: 500; }
.grow { flex: 1; }
.tb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 400 13.5px var(--font); cursor: pointer; }
.tb:hover { background: var(--surface); color: var(--text); }
.who { display: flex; align-items: center; gap: 8px; margin: 0; }
.who-t { color: var(--soft); font-size: 13px; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line-2); color: var(--text); font-weight: 600; font-size: 12px; object-fit: cover; }

.main { max-width: 1160px; margin: 0 auto; padding: 20px 20px 90px; display: flex; flex-direction: column; gap: var(--gap); }
.page-head h1 { font-size: 22px; letter-spacing: -.015em; }
.page-head.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav h1 { min-width: 170px; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px var(--pad); min-height: 46px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.card-head b { font-weight: 600; }
.empty { color: var(--faint); padding: 16px var(--pad); }

.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-bg); }
.flash.err { border-color: var(--err-line); background: var(--err-bg); }
.flash.warn { border-color: var(--run-line); background: var(--run-bg); }
.inline { display: inline; margin: 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.kpi form { margin: 0; }
.kpi.warn { border-color: var(--run-line); background: linear-gradient(var(--run-bg), var(--run-bg)), var(--surface); }
.k-label { font-size: 12.5px; color: var(--muted); }
.k-val { font: 600 23px/1.2 var(--font); letter-spacing: -.02em; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-val.ok { color: var(--ok); } .k-val.warn-t { color: var(--run); }
.k-sub { font-size: 12px; color: var(--faint); }
.kpis.small .k-val { font-size: 19px; }

/* смужки «від кого» */
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 9px var(--pad); border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-name a { color: var(--text); }
.bar-val { font-weight: 600; white-space: nowrap; }
.bar-track { grid-column: 1 / -1; height: 4px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar-track i.alt { background: var(--lamp-ok); }

/* таблиці */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 12px var(--font); color: var(--faint); padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl .num { text-align: right; }
.tbl .desc { min-width: 200px; }
.tbl .desc a b { color: var(--text-strong); font-weight: 500; }
.tbl .acts { width: 1%; }
.tbl .acts form { margin: 0; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); padding: 9px 12px; background: var(--surface-2); }
.months tr.cur td { background: var(--accent-bg); }
.months tr.cur td:first-child a { font-weight: 600; }
.months tr.nil td { color: var(--faint); }
.spark { width: 30%; vertical-align: middle !important; }
.spark i { display: block; height: 6px; border-radius: 3px; background: var(--series-2); min-width: 0; }
.months tr.cur .spark i { background: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line-2); background: none; font: 500 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.chip.due { color: var(--run); border-color: var(--run-line); background: var(--run-bg); }
.chip.paid { color: var(--ok); border-color: transparent; background: var(--ok-bg); }
.chip:hover { filter: brightness(1.15); }
.tithe-f { margin: 0; }
.icon-btn { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: var(--err-bg); color: var(--err); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--ctl); padding: 0 14px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: var(--accent-ink); font: 500 13.5px var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); }
.btn.ghost { background: none; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.sq { width: var(--ctl); padding: 0; font-size: 20px; }
.btn.danger { color: var(--err); border-color: var(--err-line); }
.link { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; text-decoration: underline; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--sunk); border: 1px solid var(--line); flex-wrap: wrap; }
.seg > a, .seg label span { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 7px; color: var(--muted); text-decoration: none !important; cursor: pointer; font-size: 13.5px; }
.seg > a.on, .seg input:checked + span { background: var(--surface); color: var(--text-strong); box-shadow: 0 0 0 1px var(--line-2); font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { position: relative; }

/* форми */
input, select, textarea { width: 100%; min-height: var(--ctl); padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--field); color: var(--text); font: 400 14px var(--font); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input.big { font-size: 22px; font-weight: 600; height: 48px; }
label, .field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.lbl { font-size: 12.5px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-foot { display: flex; gap: 8px; flex-wrap: wrap; }
.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; min-height: 18px; height: 18px; }
.tithe-box { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: var(--sunk); border: 1px solid var(--line); color: var(--soft); }
.paid-date { flex-direction: row; align-items: center; gap: 8px; }
.paid-date input { width: auto; }
.danger-zone { max-width: 760px; margin: 0; }
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.filters label { min-width: 130px; }
.filters label.grow { flex: 1; min-width: 180px; }

/* підказки замість datalist (на телефоні datalist незручний) */
.sugg-wrap { position: relative; }
.sugg { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 12px 30px rgb(0 0 0 / .35); }
.sugg button { display: block; width: 100%; padding: 9px 12px; border: 0; background: none; color: var(--text); font: 400 14px var(--font); text-align: left; cursor: pointer; }
.sugg button:hover, .sugg button.on { background: var(--hover); }

.fab { display: none; }

/* вхід */
.login-body { display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; padding: 30px 26px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login h1 { font-size: 22px; }
.login p { margin: 0; }
.btn.google { height: 46px; background: #fff; color: #1f1f1f; border-color: #dadce0; font-size: 15px; gap: 10px; }
.btn.google:hover { background: #f5f7fa; }

/* телефон */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { padding: 0 10px; gap: 2px; }
  .brand-t, .who-t, .tab span { display: none; }
  .brand { margin-right: 6px; }
  .tab { padding: 0 10px; }
  .main { padding: 14px 12px 96px; }
  .page-head h1 { font-size: 19px; }
  .month-nav h1 { min-width: 0; flex: 1; }
  .page-head.row > * { width: 100%; }
  .month-nav { justify-content: space-between; }
  .k-val { font-size: 19px; }
  .kpi { padding: 11px 12px; }
  .fgrid { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .filters label { min-width: calc(50% - 5px); flex: 1; }
  /* таблиця надходжень → картки */
  .tbl:not(.months) thead { display: none; }
  .tbl:not(.months), .tbl:not(.months) tbody, .tbl:not(.months) tr { display: block; }
  .tbl:not(.months) tr { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 44px 11px 12px; border-bottom: 1px solid var(--line); }
  .tbl:not(.months) td { display: block; padding: 0; border: 0; }
  .tbl:not(.months) td.desc { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .tbl:not(.months) td[data-l='Дата'] { grid-row: 1; color: var(--muted); font-size: 12.5px; align-self: center; }
  .tbl:not(.months) td[data-l='Сума'] { grid-row: 1; font-size: 16px; }
  .tbl:not(.months) td[data-l='Чий'] { grid-row: 3; color: var(--faint); font-size: 12.5px; align-self: center; }
  .tbl:not(.months) td[data-l='Десятина'] { display: none; }
  .tbl:not(.months) td[data-l='Сплачено'] { grid-row: 3; justify-self: end; margin-top: 4px; }
  .tbl:not(.months) td.acts { position: absolute; right: 8px; top: 8px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 8px 24px rgb(0 0 0 / .4); text-decoration: none !important; z-index: 6; }
}
