:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f0f2ef;
  --ink: #14201b;
  --muted: #5d6b65;
  --line: #e1e5e1;
  --brand: #0b6b55;
  --brand-2: #0e8a6d;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ec;
  --warn: #a35a00;
  --warn-soft: #fdf1e1;
  --bad: #b3261e;
  --bad-soft: #fce9e7;
  --ok: #1b7a43;
  --ok-soft: #e4f3ea;
  --info-soft: #e8eef8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 26, .06), 0 4px 16px rgba(16, 32, 26, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #161d1a;
    --surface-2: #1d2622;
    --ink: #e7eeea;
    --muted: #93a39c;
    --line: #2a3530;
    --brand: #2bb48f;
    --brand-2: #46c9a3;
    --brand-ink: #06231b;
    --brand-soft: #173a30;
    --warn: #f0a640;
    --warn-soft: #3a2a12;
    --bad: #ff8a80;
    --bad-soft: #3d1c1a;
    --ok: #6fd39b;
    --ok-soft: #173326;
    --info-soft: #1c2738;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
.i { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.i.lg { width: 22px; height: 22px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* шапка */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 15px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.top nav a:hover, .top nav a.on { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.top nav a.btn, .top nav a.btn:hover { color: var(--brand-ink); background: var(--brand); padding: 6px 12px; }
.top nav a.btn:hover { background: var(--brand-2); }

/* кнопки и формы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: 10px; font: inherit;
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: var(--bad-soft); }
:root { --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 32%, transparent); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
label, .label-like { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 6px; padding: 0; }
input, select, textarea, .cs-btn { width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover, .cs-btn:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); }
input:focus, select:focus, textarea:focus, .cs-btn:focus-visible, .cs.open .cs-btn {
  outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { min-height: 96px; resize: vertical; }

/* галочки и переключатели в фирменном стиле */
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; width: 20px; height: 20px;
  flex: none; padding: 0; margin: 1px 2px 0 0; display: inline-grid; place-content: center; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--ink) 28%, var(--line)); background: var(--surface);
  transition: background .15s, border-color .15s; }
input[type=checkbox] { border-radius: 6px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before { content: ""; width: 11px; height: 11px; background: var(--brand-ink);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); transform: scale(0); transition: transform .12s; }
input[type=radio]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
  transform: scale(0); transition: transform .12s; }
input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
input[type=radio]:checked { border-color: var(--brand); }
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: var(--ring); }

/* кнопка выбора файла */
input[type=file] { padding: 6px; cursor: pointer; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: 9px; padding: 8px 14px;
  margin-right: 12px; background: var(--brand-soft); color: var(--brand); cursor: pointer; transition: background .15s; }
input[type=file]::file-selector-button:hover { background: color-mix(in srgb, var(--brand) 24%, var(--surface)); }

/* свой выпадающий список (вместо системного) */
.cs { position: relative; }
.cs > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.cs-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.cs-btn:disabled { opacity: .55; cursor: not-allowed; }
.cs-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chev { color: var(--muted); transition: transform .18s; }
.cs.open .cs-chev { transform: rotate(180deg); }
.cs-pop { position: absolute; z-index: 60; left: 0; right: 0; min-width: 220px; top: calc(100% + 6px); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(10, 22, 18, .18), 0 2px 8px rgba(10, 22, 18, .08); animation: cs-in .14s ease-out; }
.cs-pop.up { top: auto; bottom: calc(100% + 6px); }
.cs-pop[hidden] { display: none; }
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-search { display: flex; align-items: center; gap: 8px; padding: 2px 8px 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line); color: var(--muted); }
.cs-search input { border: 0; background: transparent; padding: 8px 2px; box-shadow: none !important; }
.cs-list { max-height: 280px; overflow: auto; overscroll-behavior: contain; }
.cs-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.cs-opt .i { color: var(--brand); visibility: hidden; }
.cs-opt[aria-selected="true"] { font-weight: 600; }
.cs-opt[aria-selected="true"] .i { visibility: visible; }
.cs-opt.active { background: var(--surface-2); }
.cs-empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* выбор плитками (вместо списка из 2–4 вариантов) */
.choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice label { position: relative; margin: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 14.5px;
  cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.choice label:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.choice label .i { width: 22px; height: 22px; color: var(--brand); }
.choice label small { font-weight: 400; color: var(--muted); font-size: 13px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand); }
.choice label:has(input:focus-visible) { box-shadow: var(--ring); }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--ink); font-size: 14px; }

/* карточки и плашки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--ink); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
/* уведомления сбоку — поверх страницы, ничего не сдвигают */
.toasts { position: fixed; top: 76px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 14px; box-shadow: 0 18px 44px rgba(10, 22, 18, .18), 0 2px 8px rgba(10, 22, 18, .08);
  font-size: 14.5px; animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2); }
.toast > .i { color: var(--ok); margin-top: 1px; }
.toast > span { flex: 1; }
.toast.err { border-left-color: var(--bad); }
.toast.err > .i { color: var(--bad); }
.toast.out { animation: toast-out .22s ease-in forwards; }
.toast.ask { border-left-color: var(--warn); }
.toast.ask > .i { color: var(--warn); }
.ask-body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.toast-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px;
  display: grid; place-items: center; }
.toast-x:hover { color: var(--ink); background: var(--surface-2); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.note.warn { background: var(--warn-soft); }

/* кабинет */
.page { padding-top: 20px; padding-bottom: 60px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 24px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px;
  scrollbar-width: none; }
.tabs a { padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi.alert b { color: var(--bad); }
.filters { display: grid; grid-template-columns: repeat(6, 1fr) auto; gap: 8px; align-items: end; }
.filters .field { margin: 0; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:hover td { background: var(--surface-2); }
table.list td.amount { text-align: right; font-weight: 600; }
table.list .desc { color: var(--muted); font-size: 13px; }
/* таблица «название — сумма» (остатки, итоги): на телефоне не превращается в карточки */
table.sums { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.sums td { padding: 8px 0; border-bottom: 1px solid var(--line); }
table.sums td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
table.sums tr:last-child td { border-bottom: 0; }
/* остатки по неделям: кошельки строками, недели столбцами, листается вбок внутри карточки */
.hscroll { overflow-x: auto; overscroll-behavior-x: contain; }
table.weeks { border-collapse: collapse; font-size: 14px; min-width: 100%; }
table.weeks th, table.weeks td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.weeks td { text-align: right; font-variant-numeric: tabular-nums; }
table.weeks tbody th { text-align: left; font-weight: 400; position: sticky; left: 0; background: var(--surface); }
table.weeks thead th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: right; }
table.weeks thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
table.weeks tr.sec th, table.weeks tr.sec td { font-weight: 700; background: var(--surface-2); }
table.weeks .neg { color: var(--bad); font-weight: 600; }
table.weeks .desc { color: var(--muted); font-size: 11px; font-weight: 400; }
.bulkbar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.receipts { display: flex; gap: 10px; flex-wrap: wrap; }
.receipts a { display: block; width: 120px; height: 160px; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; }
.receipts img { width: 100%; height: 100%; object-fit: cover; }
.history { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2);
  border-radius: 10px; padding: 12px; white-space: pre; overflow: auto; max-height: 380px; border: 1px solid var(--line); }
.copyline { display: flex; gap: 8px; }
.copyline input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* лендинг */
.hero { padding: 64px 0 40px; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 46px; letter-spacing: -.02em; margin-bottom: 16px; }
.hero .lead { font-size: 19px; color: var(--muted); max-width: 560px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 12px; }
.chat { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px;
  box-shadow: var(--shadow); max-width: 420px; justify-self: end; width: 100%; }
.bubble { border-radius: 16px; padding: 10px 14px; margin-bottom: 10px; max-width: 88%; font-size: 14px; }
.bubble.me { background: var(--brand); color: var(--brand-ink); margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--surface-2); border-bottom-left-radius: 4px; }
.bubble.bot .kb { display: flex; gap: 6px; margin-top: 8px; }
.bubble.bot .kb span { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px; font-size: 13px; }
.section { padding: 56px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: 30px; margin-bottom: 10px; }
.section .sub { color: var(--muted); font-size: 17px; max-width: 720px; margin-bottom: 28px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cols2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.section.alt .feature { background: var(--bg); }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin-bottom: 12px; }
.feature .ico .i { width: 22px; height: 22px; }
.bubble .i { width: 1em; height: 1em; opacity: .85; }
.feature p { color: var(--muted); margin: 0; font-size: 14.5px; }
.steps { counter-reset: step; }
.steps .feature::before { counter-increment: step; content: counter(step); display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700;
  margin-bottom: 10px; }
.price { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.plan { background: var(--surface); border: 2px solid var(--brand); border-radius: 18px; padding: 24px; }
.plan .cost { font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.plan ul, .modules ul { padding-left: 18px; margin: 12px 0 0; }
.plan li, .modules li { margin-bottom: 6px; }
.modules { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.modules .mod { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.modules .mod:last-child { border-bottom: 0; }
.modules .mod b { white-space: nowrap; }
details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 10px 0 0; color: var(--muted); }
.leadform { max-width: 640px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
footer.foot { padding: 30px 0 50px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
footer.foot .wrap { display: flex; gap: 16px; flex-wrap: wrap; }

/* вход */
.login { max-width: 440px; margin: 60px auto; text-align: center; }
.login .card { padding: 30px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .hero .wrap, .price { grid-template-columns: 1fr; }
  .chat { justify-self: stretch; max-width: none; }
  .hero h1 { font-size: 34px; }
  .cols3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .cols2, .grid2, .grid3 { grid-template-columns: 1fr; }
  .choice { grid-template-columns: 1fr; gap: 8px; }
  .choice label { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 0; align-items: center;
    padding: 12px 14px; }
  .choice label .i { grid-row: span 2; }
  .toasts { top: 12px; right: 16px; left: 16px; width: auto; }
  .section { padding: 40px 0; }
  .section h2 { font-size: 24px; }
  .hero { padding: 36px 0 20px; }
  .hero h1 { font-size: 30px; }
  .top nav { margin-left: 0; width: 100%; }
  /* таблица превращается в карточки */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 8px 10px;
    background: var(--surface); position: relative; }
  table.list td { border: 0; padding: 3px 0; }
  table.list td.amount { text-align: left; font-size: 17px; }
  table.list td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 12px; }
  table.list td.sel { position: absolute; right: 10px; top: 10px; width: auto; }
  .bulkbar { position: static; }
}
