/*
  Шрифт: IBM Plex Sans для текста и IBM Plex Mono для логинов, паролей и кодов
  (в нем различаются l/I/1 и O/0). Файлы лежат локально в fonts/ (CSP не пускает
  внешние источники), лицензия - fonts/OFL.txt. Браузер грузит только нужные
  наборы символов: латиницу и кириллицу. Знака рубля в наборах нет, он берется
  из системного шрифта.
*/
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-latin-400-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: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-latin-500-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: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-600-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: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-latin-400-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: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-600-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: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

/*
  Палитра "бумага и чернила": без чисто белого и чисто черного, один акцент.
  Цвет несет смысл: чернила - главное действие, текущий раздел и фокус;
  красный - только минус и "не хватает". Зеленого нет: плюс - обычный текст.
*/
:root {
  --bg: #f2f3f1;        /* бумага: фон страницы */
  --panel: #fbfbfa;     /* лист: таблицы, панели, диалоги */
  --text: #22262a;
  --muted: #5c636b;     /* карандаш: вторичный текст, контраст ~5.5:1 */
  --line: #dadddb;      /* разлиновка */
  --accent: #1d5466;    /* чернила */
  --accent-text: #f7fafb;
  --chip: #e3ecee;
  --chip-text: #1d5466;
  --danger: #a63a2e;    /* минус */
  --ok: #3f6b52;        /* только сообщение "сохранено" */
  --hover: #eef0ed;
  --shadow: 0 12px 40px rgba(20, 30, 35, .16);
  --r1: 6px;            /* поля и кнопки */
  --r2: 8px;            /* листы и диалоги */
  --ctl: 36px;          /* высота полей, списков, кнопок и вкладок: в одной строке стоят ровно */
  color-scheme: light;
}
/*
  Темная тема: по системе, если не выбрана светлая, или явно выбранная
  (атрибут data-theme на <html> ставит theme.js до отрисовки).
  Значения в двух блоках одинаковые: при правке менять оба.
*/
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181b;
    --panel: #1b1f23;
    --text: #d5d9dd;
    --muted: #949ba3;
    --line: #2b3035;
    --accent: #7fb3c4;
    --accent-text: #0f2a33;
    --chip: #20343b;
    --chip-text: #a9cfdb;
    --danger: #e07a6e;
    --ok: #8fb89f;
    --hover: #22272c;
    --shadow: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181b;
  --panel: #1b1f23;
  --text: #d5d9dd;
  --muted: #949ba3;
  --line: #2b3035;
  --accent: #7fb3c4;
  --accent-text: #0f2a33;
  --chip: #20343b;
  --chip-text: #a9cfdb;
  --danger: #e07a6e;
  --ok: #8fb89f;
  --hover: #22272c;
  --shadow: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Шкала: 13 / 15 / 18 / 22 */
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1 { font-size: 18px; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1em; margin: 8px 0 0; }
.mono { font-family: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace; }
.strong { font-weight: 600; }

input, select, textarea, button {
  font: inherit;
  color: inherit;
}
input, select, textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 7px 10px;
  min-width: 0;
  width: 100%;
}
textarea { resize: vertical; }
/* Однострочные поля, списки и кнопки - одной высоты: высота задана явно,
   а не складывается из отступов, которые у полей и списков разные */
input:not([type=checkbox], [type=radio], [type=file]), select,
button:not(.icon, .small, .chip) {
  height: var(--ctl); padding-top: 0; padding-bottom: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
/* Фокус с клавиатуры виден на всем, что можно нажать */
button:focus-visible, summary:focus-visible, a:focus-visible, tr[tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button, summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r1);
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, summary:hover { background: var(--hover); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.wide { width: 100%; }
button:disabled { opacity: .6; cursor: default; }
button.icon {
  padding: 4px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
}
button.icon:hover { color: var(--text); background: var(--hover); }
button.icon svg { width: 16px; height: 16px; }

/* Экран входа */
.lock { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.lock-card {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2);
  padding: 24px;
}
.lock-card h1 { margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.field label { font-size: 13px; font-weight: 500; }

/* Основной экран */
#app { max-width: 1280px; margin: 0 auto; padding: 16px; }
/* Строка авторизации */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.session { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
#who { font-size: 13px; margin-right: 4px; }
/* Панель над таблицей: края совпадают с краями таблицы */
.toolbar { display: flex; flex-direction: column; gap: 8px; }
.actions-row, .filters-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters-row input[type=search] { flex: 1 1 260px; }
.filters-row select { width: auto; max-width: 240px; }
.statusbar { display: flex; justify-content: space-between; gap: 12px; margin: 12px 2px 8px; font-size: 13px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }

.empty {
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r2);
  padding: 32px; text-align: center; color: var(--muted);
}

table.accs {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden;
}
.accs th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.accs td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.accs tr:last-child td { border-bottom: 0; }
.accs tbody tr:hover { background: var(--hover); }
.cell { display: flex; align-items: center; gap: 4px; min-height: 26px; }
.cell .mono { word-break: break-all; }
.pw { letter-spacing: .04em; }
.totp { font-size: 16px; letter-spacing: .12em; font-weight: 600; }
.ttl { font-size: 12px; min-width: 2.5em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  background: var(--chip); color: var(--chip-text); border: 0; border-radius: 4px;
  padding: 2px 8px; font-size: 12px;
}
.chip:hover { background: var(--chip); filter: brightness(.95); }
.extra { font-size: 13px; color: var(--muted); max-width: 320px; }
.extra div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.extra b { color: var(--text); font-weight: 500; }
td.act { text-align: right; width: 1%; }
.accs tr.group td { background: var(--hover); font-size: 13px; padding: 7px 12px; }
.accs tr.group.off td { opacity: .75; }
.cell.wrap { flex-wrap: wrap; }

/* Роли: у сотрудника нет кнопок администратора */
body:not(.is-admin) .admin-only { display: none !important; }
.nowrap { white-space: nowrap; }
.badge {
  display: inline-block; font-size: 12px; line-height: 1.6; padding: 0 7px; margin-left: 6px;
  border-radius: 4px; background: var(--chip); color: var(--chip-text); white-space: nowrap;
}
.badge.warn { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
/* "Все в порядке" - нейтральная рамка, без цвета: внимание забирают только проблемы */
.badge.ok { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
button.small { padding: 4px 10px; font-size: 13px; }
.ok-text { min-height: 1em; }

/* Диалоги */
dialog {
  border: 1px solid var(--line); border-radius: var(--r2); padding: 0;
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
dialog.wide { width: min(1000px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 14, 20, .45); }
.users-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.user-row {
  display: grid; grid-template-columns: 150px 1fr 170px auto auto; gap: 8px; align-items: center;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.user-row.off input { opacity: .7; }
.user-row select { width: auto; }
.user-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-add { display: grid; grid-template-columns: 150px 1fr 170px auto; gap: 8px; align-items: center; }
.temp-pass { font-size: 18px; letter-spacing: .06em; }
.audit-list { max-height: 60vh; overflow: auto; }
table.audit { width: 100%; border-collapse: collapse; font-size: 13px; }
.audit th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.audit td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.audit tr.warn td { color: var(--danger); }
.dlg { padding: 20px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid .full { grid-column: 1 / -1; }
.row { display: flex; gap: 6px; align-items: center; }
.row input { flex: 1; }
fieldset { border: 1px solid var(--line); border-radius: var(--r2); margin: 14px 0 0; padding: 8px 12px 12px; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.checks input { width: auto; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.check input { width: auto; }
.admin2fa { font-size: 13px; }
.fields { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.frow { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 6px; align-items: center; }
.frow label { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.frow input[type=checkbox] { width: auto; }
.trow { display: grid; grid-template-columns: 1fr 1.6fr auto auto; gap: 6px; align-items: center; }
.trow label { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.trow input[type=checkbox] { width: auto; }
.trow .admin-note { font-size: 13px; color: var(--muted); padding: 0 4px; }
.codes { display: flex; flex-direction: column; gap: 2px; }
.code-label { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.grow { flex: 1; }
.prog-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.prow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.pay-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.pay-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.pay-row .card { font-size: 12px; }
.card-grid { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 0 12px; }
.top-gap { margin-top: 14px; }
.sub-row { gap: 14px; flex-wrap: wrap; min-height: 36px; }
.sub-row label { white-space: nowrap; font-size: 13px; }
.sub-row input[type=date] { width: auto; }
.sub-row + .sub-row { margin-top: 6px; }
/* В отборе подписок закончившиеся (отмененные) приглушены */
.accs.sub-only tr.sub-ended td { opacity: .55; }
.block-gap { display: block; margin-top: 10px; }

/* Разделы и подразделы */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; margin-left: 12px; }
.tabs a, .subtabs a {
  color: var(--muted); text-decoration: none; padding: 7px 12px; line-height: 22px;
  border-radius: var(--r1); white-space: nowrap;
}
/* Вкладка той же высоты, что кнопки (7 + 22 + 7 = --ctl) */
.tabs a { display: inline-block; }
.tabs a:hover, .subtabs a:hover { background: var(--hover); color: var(--text); }
.tabs a.on { background: var(--chip); color: var(--chip-text); font-weight: 600; }
.subtabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.subtabs a { border-radius: var(--r1) var(--r1) 0 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
#pageAdmin .subtabs { margin-bottom: 14px; }
/* Подразделы и главная кнопка раздела - на одной линии */
/* Кнопка стоит над линией подчеркивания вкладок и совпадает с ними по высоте:
   обе высотой --ctl, снизу у вкладки 2px подчеркивания, у кнопки 2px отступа */
.tabs-row { display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--line); }
.tabs-row .subtabs { border-bottom: 0; margin-bottom: 0; flex: 1; }
.tabs-row .subtabs a { margin-bottom: 0; }
.tabs-row > button { margin: 0 0 2px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 20px; }
.panel.narrow { max-width: 720px; }
.panel h2 { margin-bottom: 8px; }
/* Справка: строка не длиннее, чем глаз удобно проходит за раз */
.panel p.muted, .fin-body > p.muted, .dlg small.muted, .dlg p.muted { max-width: 75ch; }

/* Финансы */
.fin-body { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.fin-body h3 { font-size: 15px; margin: 8px 0 0; }
.balances h3 { margin: 0 0 8px; }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Числовые колонки - по правому краю, чтобы разряды стояли друг под другом */
.fin th.r, .fin td.r { text-align: right; }
.fin td.r { font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
/* Плюс - обычный текст: цвет только у минуса */
.num.in { color: inherit; }
/* Ключевые цифры - строкой, как итоги в книге: без карточек, через тонкие вертикальные линии */
.stats { display: flex; flex-wrap: wrap; align-items: stretch; row-gap: 12px; padding: 4px 0; }
.stat { padding: 0 28px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat > .muted:first-child { font-size: 13px; }
.stat.warn .stat-val { color: var(--danger); }
.stat-val { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 2px 0; font-variant-numeric: tabular-nums; }
.stat-act { display: flex; align-items: center; padding-left: 28px; }
/* Табличные данные чуть плотнее основного текста */
table.fin, table.accs { font-size: 14px; }
.notice { border-radius: var(--r2); padding: 10px 14px; border: 1px solid var(--line); background: var(--panel); }
.notice.warn { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.notice a { color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); }
.table-wrap.narrow { max-width: 720px; }
table.fin { width: 100%; border-collapse: collapse; }
.fin th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: bottom;
}
.fin td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.fin tbody tr:last-child td { border-bottom: 0; }
.fin tbody tr:hover { background: var(--hover); }
.fin tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; }
.fin tr.neg-row td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.fin tr.current td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fin .act { text-align: right; width: 1%; }
/* Групповая шапка: имя кошелька над парой колонок */
.fin th.grp { text-align: center; color: var(--text); padding-bottom: 4px; }
.fin thead tr + tr th { padding-top: 4px; }
/* Строка, которая открывает карточку */
tr.edit { cursor: pointer; }
tr.edit:focus-visible { outline-offset: -2px; }
.files { display: flex; flex-direction: column; gap: 2px; }
.files a, a.file { color: var(--accent); font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row { display: flex; gap: 8px; align-items: center; }
.file-row a, .file-row span:first-child { max-width: none; font-size: 13px; }
#oFiles { margin-bottom: 8px; }
#oFile { border: 0; padding: 0; background: transparent; }
/* Выбор файла - в стиле обычной кнопки, а не системный */
input[type=file]::file-selector-button {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r1); padding: 6px 12px; margin-right: 10px; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--hover); }
input[type=file] { color: var(--muted); font-size: 13px; }
input.num { text-align: right; }
.sub-row #fSubCost { width: 90px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: var(--r1);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Короткая подпись кнопки - только на узком экране */
.narrow-only { display: none; }

/* Телефон: таблица превращается в карточки */
@media (max-width: 760px) {
  /* Шапка в две строки: название и кнопки, под ними разделы */
  .top { gap: 8px; }
  #who { display: none; }
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .session { gap: 6px; }
  .session button { padding: 5px 10px; font-size: 13px; }
  .filters-row input[type=search] { flex-basis: 100%; }
  .filters-row select { flex: 1 1 100%; max-width: none; }
  table.accs, .accs tbody, .accs tr, .accs td { display: block; width: 100%; }
  .accs thead { display: none; }
  table.accs { background: transparent; border: 0; }
  .accs tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2);
    margin-bottom: 10px; padding: 6px 0;
  }
  .accs td { border: 0; padding: 4px 12px; }
  .accs td[data-label]::before, .fin.ops td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12px; color: var(--muted);
  }
  /* Операции - карточками, как учетки; пустые поля не показываются */
  .table-wrap:has(> .fin.ops) { background: transparent; border: 0; overflow: visible; }
  table.fin.ops, .fin.ops tbody, .fin.ops tr, .fin.ops td { display: block; width: 100%; }
  .fin.ops thead { display: none; }
  .fin.ops tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2);
    margin-bottom: 10px; padding: 6px 0;
  }
  .fin.ops td, .fin.ops tbody tr:last-child td { border: 0; padding: 4px 12px; text-align: left; }
  .fin.ops td:empty, .fin.ops td:has(> .files:empty) { display: none; }
  /* Компактная карточка: дата и вид слева, сумма USDT крупно справа, остальное ниже */
  .fin.ops tr { display: grid; grid-template-columns: 1fr auto; }
  .fin.ops td { grid-column: 1 / -1; }
  .fin.ops td:nth-child(1) { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 13px; padding-bottom: 0; }
  .fin.ops td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .fin.ops td:nth-child(5) { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; font-size: 17px; font-weight: 600; }
  .fin.ops td:is(:nth-child(1), :nth-child(2), :nth-child(5))::before { display: none; }
  .fin.ops td:is(:nth-child(3), :nth-child(4))::before { display: inline; content: attr(data-label) ": "; }
  .fin.ops tr.neg-row td:first-child { box-shadow: none; }
  .fin.ops tr.neg-row { border-left: 3px solid var(--danger); }
  td.act { text-align: left; width: auto; }
  .accs tr.group { background: transparent; border: 0; margin: 14px 0 6px; padding: 0; }
  .accs tr.group td { background: transparent; padding: 0 4px; }
  .user-row, .user-add { grid-template-columns: 1fr 1fr; }
  .audit-list { font-size: 12px; }
  .grid { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1fr 1fr; }
  .trow { grid-template-columns: 1fr auto auto; }
  .trow > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .card-grid { grid-template-columns: 1fr; }
  .pay-row { grid-template-columns: 1fr auto; }
  .extra { max-width: none; }
  .tabs { order: 3; flex-basis: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .subtabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .statusbar { flex-direction: column; gap: 2px; }
  /* Широкие таблицы прокручиваются вбок, первая колонка (месяц, дата) остается на месте */
  .table-wrap .fin:not(.ops) :is(td, th):first-child {
    position: sticky; left: 0; z-index: 1; background: var(--panel);
    box-shadow: inset -1px 0 0 var(--line);
  }
  .tabs-row { flex-wrap: wrap; border-bottom: 0; }
  .tabs-row .subtabs { flex-basis: 100%; border-bottom: 1px solid var(--line); }
  .tabs-row > button { margin: 8px 0 0; }
  .panel { padding: 14px; }
  /* Цифры на телефоне - по две в ряд, без вертикальных линий */
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .stat, .stat:first-child, .stat-act { padding: 0; border-left: 0; }
}
