:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --text: #17202b;
  --muted: #637083;
  --line: #e2e6ec;
  --accent: #1f5fbf;
  --accent-soft: #e6eefb;
  --pos: #1b7f4b;
  --neg: #b4471f;
  --danger: #c0352b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 12px;
  --chart: #1f5fbf;
  --warn-bg: #fff6e0;
  --warn-text: #7a4b00;
  color-scheme: light;
}
/* Тёмная тема: по настройке телефона, если пользователь не выбрал светлую; или выбрана явно (вкладка «Инфо») */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419;
    --surface: #182029;
    --text: #e6ebf1;
    --muted: #93a0b1;
    --line: #2a3542;
    --accent: #6ea4ff;
    --accent-soft: #1d2d47;
    --pos: #4fc386;
    --neg: #f08a5d;
    --danger: #ff6b5e;
    --shadow: none;
    --chart: #4f8ef0;
    --warn-bg: #3a2c10;
    --warn-text: #f3c56b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #182029;
  --text: #e6ebf1;
  --muted: #93a0b1;
  --line: #2a3542;
  --accent: #6ea4ff;
  --accent-soft: #1d2d47;
  --pos: #4fc386;
  --neg: #f08a5d;
  --danger: #ff6b5e;
  --shadow: none;
  --chart: #4f8ef0;
  --warn-bg: #3a2c10;
  --warn-text: #f3c56b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }

.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; max-width: 760px; margin: 0 auto; }
.branch { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 760px; margin: 8px auto 0; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; }
.branch[hidden] { display: none; }
.branch #branch-t { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-chev { flex: none; font-size: 12px; }

/* Выбор отделов галочками (Z39) */
.br-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.br-head b { font-size: 17px; }
.br-head .btn { height: 38px; }
.br-list { max-height: 55vh; overflow: auto; }
.br-list .br-item { flex-direction: row; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line);
  font-size: 16px; color: var(--text); cursor: pointer; }
.br-list .br-item:last-child { border-bottom: 0; }
.br-list .br-item input { width: 20px; height: 20px; flex: none; }
.br-err { margin-top: 8px; font-size: 13px; color: var(--danger); }
.top h1 { margin: 0; font-size: 19px; }
.fresh { color: var(--muted); font-size: 12px; text-align: right; }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }

/* Фильтры */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.grow { flex: 1 1 0; min-width: 0; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
input, select, button { font: inherit; color: inherit; }
input[type=date], input[type=search], select, .login input {
  width: 100%; height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.toggle { flex-direction: row; align-items: center; gap: 6px; height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14px; }
.toggle input { margin: 0; width: 18px; height: 18px; accent-color: var(--accent); }

.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; min-height: 44px; padding: 4px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Итоги */
.summary { font-size: 13px; color: var(--muted); margin: 4px 2px 10px; }
.summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.total { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.total .cur { font-size: 12px; color: var(--muted); }
.total div { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }

/* Карточки */
.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; cursor: pointer;
}
.card-top { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.c-name { font-weight: 600; overflow-wrap: anywhere; }
.c-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.c-val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-val b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.c-val small { color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
/* Суммы в USD по курсу у.е. — второй строкой под суммой в BYN */
.usd { display: block; color: var(--muted); font-size: 12px; font-weight: 400; text-align: right; }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
#d-src { margin-bottom: 8px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.move { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.move b { color: var(--text); font-weight: 500; }

.detail { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.detail table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.detail td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.detail tr:last-child td { border-bottom: 0; }
.detail td.n { text-align: right; padding-left: 8px; white-space: nowrap; }

.more, .actions button, .primary {
  display: block; width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; color: var(--accent); margin-top: 8px;
}
.primary { background: var(--accent); color: #fff; border: 0; }
.danger { color: var(--danger) !important; }

.msg { text-align: center; color: var(--muted); padding: 32px 12px; }
.msg.err, .err { color: var(--danger); }
.spinner { width: 26px; height: 26px; margin: 0 auto 10px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Вход */
.login { max-width: 360px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.login h2 { margin: 0 0 4px; text-align: center; }
.login label { font-size: 13px; }
.logo { text-align: center; }
.login-links { display: flex; justify-content: space-between; }
.link { background: none; border: 0; color: var(--accent); padding: 10px 4px; font-size: 14px; min-height: 44px; }
.reg-state { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.45; }
.reg-state ol { margin: 0; padding-left: 20px; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn.primary, .btn.primary { background: var(--accent); color: #fff; border: 0; }
.count { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 4px; border-radius: 8px; background: var(--danger);
  color: #fff; font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; vertical-align: 1px; }
.req-actions { display: flex; gap: 8px; margin-top: 8px; }
.req-actions button { flex: 1; }
.aging { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.aging b, .c-val .aging b { display: inline; font-size: inherit; color: var(--text); font-weight: 600; }
.lines .sub { font-size: 12px; color: var(--muted); padding-left: 12px; }
.lines .sub b { font-weight: 600; color: var(--text); }
.logo img { width: 72px; height: 72px; border-radius: 18px; }

/* Инфо */
.info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; }
.info dl { margin: 0; }
.info div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.info div:last-child { border-bottom: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; text-align: right; }
.info .note { display: block; font-size: 12px; color: var(--muted); }

/* Нижнее меню */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 max(0px, calc((100% - 760px) / 2)) env(safe-area-inset-bottom);   /* кнопки — в колонке содержимого */
}
.tabs button { flex: 1; border: 0; background: none; padding: 8px 0 7px; font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs svg { display: block; margin: 0 auto 2px; }
.tabs button.on { color: var(--accent); }

/* Нижняя шторка с деталями */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel { background: var(--bg); width: 100%; max-width: 760px; max-height: 85vh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { position: sticky; top: 0; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.sheet-head button { border: 0; background: var(--surface); width: 44px; height: 44px; border-radius: 50%; font-size: 15px; flex: none;
  display: flex; align-items: center; justify-content: center; }
/* Сводка */
.sum-card .lines { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sum-card .lines div { display: flex; justify-content: space-between; gap: 12px; }
.sum-card .lines span { color: var(--muted); }
.sum-card.total { border-color: var(--accent); }
.links { display: flex; gap: 8px; margin-top: 10px; }
.links button { flex: 1; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--accent); font-weight: 600; }

/* Администрирование */
.admin { margin-top: 12px; padding-bottom: 70px; }
.admin h4 { margin: 18px 2px 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 2px 10px; }
.checks { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; }
.checks label { flex-direction: row; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 15px; color: var(--text); }
.checks label:last-child { border-bottom: 0; }
.checks input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); margin: 0; }
.checks small { color: var(--muted); margin-left: auto; }
.checks .d1 { padding-left: 24px; }
.checks .d2 { padding-left: 48px; }
.checks .d3 { padding-left: 72px; }
.checks small + small { margin-left: 8px; }
.checks .other { background: var(--warn-bg); color: var(--warn-text); border-radius: 6px; padding: 1px 6px; }
.checks label.hid { display: none; }
.checks .tw { flex: none; width: 28px; height: 28px; margin: -4px -6px -4px -8px; border: 0; background: none;
  color: var(--muted); font-size: 16px; cursor: pointer; }
.checks.fold .d1 { padding-left: 46px; }
.checks.fold .d2 { padding-left: 70px; }
.checks.fold .d3 { padding-left: 94px; }
.c-search { width: 100%; margin-bottom: 8px; }
.c-all { height: 36px; margin-bottom: 8px; }   /* «Все» / «Снять все» над списком (Z48) */
/* Глазик в поле пароля (Z49) и текущий пароль в карточке пользователя (Z50) */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 42px; height: 40px; border: 0; background: none;
  color: var(--muted); display: flex; align-items: center; justify-content: center; }
.curpass { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.curpass span { color: var(--muted); }
.curpass b { font-family: ui-monospace, Consolas, monospace; font-size: 17px; user-select: all; }
.curpass .pw-eye { position: static; transform: none; margin-left: auto; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form input[type=text], .form input[type=password], .form input[type=tel] { width: 100%; height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.btn-row { display: flex; gap: 8px; }
.btn-row button { flex: 1; margin-top: 0; }
.btn { height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-weight: 600; padding: 0 12px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.badge.off { background: var(--line); color: var(--muted); }
.badge.hl { background: var(--warn-bg); color: var(--warn-text); }
.savebar { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 7;
  display: flex; align-items: center; gap: 8px; padding: 8px max(16px, calc((100% - 760px) / 2 + 16px)); background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .08); }
.savebar span { flex: 1; font-size: 13px; color: var(--muted); }
.savebar button { height: 38px; border-radius: 10px; padding: 0 14px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.savebar .primary { width: auto; margin: 0; display: inline-block; }
.ok { color: var(--pos); }

.firm-h { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 2px 6px; }
.mt10 { margin-top: 10px; }
.wide { width: 100%; }
.form-end { margin: 14px 0 4px; }
/* Иконки Lucide из icons.svg: размер 16 — в таблицах и строках, 20 — кнопки, 24 — нижнее меню */
.i { width: 20px; height: 20px; flex: none; vertical-align: -0.25em; }
.i-sm { width: 16px; height: 16px; margin-right: 4px; vertical-align: -0.2em; }
.i-lg { width: 24px; height: 24px; }
.actions button .i, #sheet-close .i { margin-right: 6px; }
#sheet-close .i { margin: 0; }
.warn { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--warn-bg); color: var(--warn-text); font-size: 14px; line-height: 1.35; }
.warn .i { margin-top: 1px; }
/* Диаграммы сводки: цвет --chart проверен валидатором dataviz (светлая и тёмная темы) */
.chart-card .c-name { margin-bottom: 4px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart .dot.on, .chart .dot.last { r: 5; }
.chart .bar { fill: var(--chart); }
.chart text { font-size: 11px; fill: var(--muted); }
.chart .lbl { fill: var(--text); font-size: 12px; }
.chart .val { fill: var(--text); font-weight: 600; font-size: 12px; }
.readout { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.readout b { color: var(--text); }
.tbl { margin-top: 6px; font-size: 13px; color: var(--muted); }
.tbl summary { cursor: pointer; }
.tbl table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.tbl td { padding: 3px 0; border-top: 1px solid var(--line); }
.tbl td:last-child { text-align: right; color: var(--text); }
.offline { display: flex; align-items: center; gap: 6px; max-width: 760px; margin: 8px auto 0; padding: 6px 10px;
  border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
.offline[hidden] { display: none; }
.theme-pick { margin-top: 12px; font-size: 13px; color: var(--muted); }
.theme-pick .seg { margin-top: 4px; }

/* Остатки по группам и резервы */
#s-mode { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 10px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); font-weight: 600; }
.chip span { color: var(--muted); font-weight: 400; }
.detail th { font-weight: 500; color: var(--muted); font-size: 12px; }
.detail th.n { text-align: right; }
.checks small.sub { display: block; margin-left: 0; font-size: 12px; }

/* Окно вопроса (Z05): поверх шторки и полосы сохранения */
.dlg { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 18px 16px 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.dlg-text { font-size: 15px; line-height: 1.45; white-space: pre-line; }
.dlg-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dlg-btns .btn { flex: 1 1 0; min-width: 96px; margin-top: 0; }   /* общий отступ .primary сдвигал её ниже соседней (Z37) */
.dlg-btns .btn.danger { background: var(--danger); color: #fff !important; border: 0; }

/* Поле даты дд.мм.гггг и кнопка календаря (Z13); системное поле скрыто, но открывает свой календарь */
.datebox { position: relative; display: flex; gap: 6px; }
.datebox input[type=text] { flex: 1; min-width: 0; height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; color: var(--text); }   /* дата крупно (Z36) */
.filters label > span { font-size: 13px; }

/* Свой календарь на русском (Z36) */
.cal { max-width: 360px; padding: 14px 12px 12px; }
.cal-cap { font-size: 14px; color: var(--muted); text-align: center; margin-bottom: 2px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 18px; }
.cal-head button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--accent); font-size: 26px; line-height: 1; cursor: pointer; }
.cal-wd, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-wd span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-wd span:nth-child(n+6) { color: var(--danger); }
.cal-days button { height: 42px; border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 17px;
  font-variant-numeric: tabular-nums; cursor: pointer; }
.cal-days button.now { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-days button.on { background: var(--accent); color: #fff; font-weight: 700; }
.cal .dlg-btns { margin-top: 10px; }
.datebox input.bad { border-color: var(--danger); color: var(--danger); }
.datebtn { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.datebox .native-date { position: absolute; right: 0; bottom: 0; width: 44px; height: 44px; opacity: 0; pointer-events: none; padding: 0; border: 0; }

/* Сроки долга двумя столбиками (Z08): подписи слева одним столбиком, суммы по правому краю */
.ag-grid { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; row-gap: 2px; margin-top: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ag-grid span { color: var(--muted); }
.ag-grid b { text-align: right; font-weight: 600; white-space: nowrap; }

/* Пять вкладок «Админа» на узком телефоне — без прокрутки вбок */
#a-tabs button { min-width: 0; padding: 4px 2px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 400px) { #a-tabs button { font-size: 12px; } }
#a-tabs button { flex: 1 1 auto; }

/* Остатки товаров и взаиморасчёты: полоса валюты, уровни, таблица категорий (Z22–Z33) */
.curbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 10px; }
.curbar .seg.mini { padding: 2px; }
.curbar .seg.mini button { flex: none; min-height: 38px; min-width: 48px; padding: 0 9px; font-size: 13px; }
.curbar .seg.mini + .seg.mini { margin-left: auto; }   /* сроки долга — к правому краю (Z33) */
.curbar .rate { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.lvl { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.lvl .back { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--accent); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lvl-t { font-size: 18px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.lvl-s { font-size: 12px; color: var(--muted); }
.hcard { cursor: default; }
.hcard-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.hcard-h h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hcard .hint { margin: 2px 0 6px; }
.gobtn { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 14px; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow); }
.stbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.stbl th { font-size: 11px; font-weight: 600; color: var(--muted); text-align: right; padding: 4px 0 4px 6px; text-transform: uppercase; letter-spacing: .02em; }
.stbl td { padding: 7px 0 7px 6px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); font-weight: 600; vertical-align: middle; }
.stbl td small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.stbl td:first-child { padding-left: 0; text-align: left; white-space: normal; width: 34%; }
.stbl td.free { color: var(--pos); }
.stbl tr.tot td { font-weight: 700; }
.stbl tr[data-cat], .stbl tr[data-grp] { cursor: pointer; }
.catbtn { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 4px; min-height: 40px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; text-align: left; cursor: pointer; }
.catbtn span { font-size: 18px; line-height: 1; }
@media (max-width: 420px) {
  .stbl { font-size: 13px; }
  .stbl th, .stbl td { padding-left: 4px; }
  .stbl th { font-size: 10px; letter-spacing: 0; }
  .catbtn { padding: 6px 7px; font-size: 13px; }
}
.qboxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.qbox { display: grid; grid-template-columns: auto 1fr; column-gap: 4px; align-items: baseline; background: var(--bg); border-radius: 8px; padding: 6px 7px;
  font-variant-numeric: tabular-nums; }
.qbox .l { font-size: 11px; color: var(--muted); }
.qbox b { text-align: right; font-size: 15px; white-space: nowrap; }
.qbox small { grid-column: 1 / -1; text-align: right; font-size: 11px; color: var(--muted); white-space: nowrap; }
.qbox.free b { color: var(--pos); }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.card.flat { cursor: default; }

/* Взаиморасчёты: крупно «Нам должны» слева, под ним «BYN на дату»; справа крупно сумма и тонким курсивом в $ (Z08/Z09) */
.big { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 4px; }
.big .lbl { font-size: 20px; font-weight: 600; }
.big .cur { font-size: 12px; color: var(--muted); margin-top: 2px; }
.big-r { text-align: right; }
.big-r b { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }
.usd-i { display: block; font-size: 14px; font-style: italic; font-weight: 300; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sep { border-top: 1px solid var(--line); margin: 10px 0 0; }
.second { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; margin-top: 8px; align-items: baseline; font-size: 14px; }
.second span { font-weight: 600; }
.second b { text-align: right; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.second .usd-i { grid-column: 2; text-align: right; font-size: 13px; }
/* Итог списка: «Итого: долг свыше N дней», ниже «клиентов: N» (Z34); сумма справа */
.itog { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 2px 2px 8px; font-size: 13px; color: var(--muted); }
.itog small { display: block; font-size: 12px; margin-top: 2px; }
.itog > b { font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.itog > b small { color: var(--muted); font-weight: 400; }
.itog > b span { display: block; }

/* Период на узком телефоне (Z13): две даты целиком, «Период» переносится на строку ниже */
.filters .row { flex-wrap: wrap; }
.filters .row > label.grow { min-width: 150px; }

/* Неоплаченные приходы поставщика в его окне (Z40) */
.feed { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 13px; }
.feed .h { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.feed .r { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; padding: 3px 0; align-items: baseline; font-variant-numeric: tabular-nums; }
.feed .r .d { font-weight: 600; }
.feed .r .n { color: var(--muted); font-size: 12px; }
.feed .r b { text-align: right; white-space: nowrap; }
.feed .r.prev .d, .feed .r.prev .n { color: var(--danger); }

/* Голосовая команда: кнопка в шапке, окно с распознанной фразой, подсказка «что понято» */
.top-row { align-items: center; }
.top h1 { white-space: nowrap; flex: none; }   /* с кнопкой микрофона переносится подпись «Данные 1С», а не заголовок */
.top-r { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mic { flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.mic.big { width: 52px; height: 52px; }
.mic.big .i { width: 26px; height: 26px; }
.mic.on { background: var(--danger); border-color: var(--danger); color: #fff; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, .45); } 50% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); } }
.v-state { min-height: 20px; margin: 4px 0 8px; font-size: 14px; color: var(--muted); }
.vbox input[type=text] { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 17px; color: var(--text); }
.v-hint { margin-top: 10px; font-size: 13px; }
.v-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15;
  width: calc(100% - 32px); max-width: 520px; padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--surface);
  font-size: 14px; line-height: 1.4; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.v-toast b { font-weight: 600; }
