/* Финучёт МЗ — оформление как в дашбордах БаланСыча (Phangaia): Manrope + JetBrains Mono для цифр,
   тёплый фон, бирюзовый акцент. Цвета — только через токены ниже (24.11.2026, просьба владельца). */
:root {
  color-scheme: light;
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #eeebe3; --line: #dcd8ce; --line-2: #e9e6de;
  --ink: #152329; --ink-2: #4d5960; --muted: #7d868c;
  --accent: #0e7c86; --accent-ink: #ffffff; --accent-soft: #d9eef0;
  --pos: #008300; --neg: #d63a39; --neg-soft: #fbe9e8; --warn: #b26a00; --warn-soft: #fbefd9;
  --s1: #2a78d6; --s2: #eb6834; --grid: #e9e6de;
  --shadow: 0 1px 2px rgba(21,35,41,.06), 0 6px 20px rgba(21,35,41,.05);
  --radius: 12px;
  --side: 236px;
  --ease: cubic-bezier(.4,0,.2,1);
  --sat: env(safe-area-inset-top,0px); --sar: env(safe-area-inset-right,0px);
  --sab: env(safe-area-inset-bottom,0px); --sal: env(safe-area-inset-left,0px);
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141a1d; --surface: #1d2428; --surface-2: #252d32; --line: #354045; --line-2: #2b3438;
    --ink: #eff0ea; --ink-2: #c2c6bf; --muted: #8d969a;
    --accent: #3fb2bb; --accent-ink: #0f1b1d; --accent-soft: #1f3a3e;
    --pos: #4cbf4c; --neg: #e66767; --neg-soft: #3a2324; --warn: #e2a13a; --warn-soft: #3a2e17;
    --s1: #3987e5; --s2: #d95926; --grid: #2b3438;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141a1d; --surface: #1d2428; --surface-2: #252d32; --line: #354045; --line-2: #2b3438;
  --ink: #eff0ea; --ink-2: #c2c6bf; --muted: #8d969a;
  --accent: #3fb2bb; --accent-ink: #0f1b1d; --accent-soft: #1f3a3e;
  --pos: #4cbf4c; --neg: #e66767; --neg-soft: #3a2324; --warn: #e2a13a; --warn-soft: #3a2e17;
  --s1: #3987e5; --s2: #d95926; --grid: #2b3438;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Manrope, "Segoe UI", system-ui, -apple-system, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; font-weight: 620; }
.num, .tnum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── каркас ── */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;   /* пунктов больше, чем влезает по высоте, — меню прокручивается */
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.brand b { display: block; font-size: 15px; line-height: 1.2; color: var(--ink); }
.brand > span:not(.brand-mark) span { display: block; font-size: 12px; color: var(--muted); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2);
  font-weight: 500; min-height: 40px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-cta { margin: 6px 0 4px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 6px 0; display: flex; align-items: center; gap: 8px; }
.who { flex: 1; min-width: 0; font-size: 13px; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { color: var(--muted); font-size: 12px; }
.iconbtn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; padding: 0;
}
.iconbtn:hover { background: var(--surface-2); }
.iconbtn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; padding: 26px 32px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.topbar { display: none; }

/* ── кнопки и поля ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-danger { color: var(--neg); }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 11px; min-height: 40px; width: 100%; max-width: 100%;
}
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

/* ── период ── */
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.chips a { padding: 6px 11px; border-radius: 9px; color: var(--ink-2); font-size: 14px; font-weight: 500; min-height: 34px; display: flex; align-items: center; }
.chips a:hover { background: var(--surface-2); text-decoration: none; }
.chips a.on { background: var(--accent); color: var(--accent-ink); }
.range { display: flex; gap: 6px; align-items: center; }
.range select { width: auto; min-height: 40px; padding: 6px 8px; font-size: 14px; }

/* ── карточки ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 4px; }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi-sub { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.kpi-sub a { font-weight: 560; }
.delta { font-weight: 600; }
.delta.up.good, .delta.down.bad-down { color: var(--pos); }
.delta.down.good, .delta.up.bad-down { color: var(--neg); }

.note {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--ink); font-size: 14px; margin-bottom: 16px;
}
.note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; stroke: var(--warn); fill: none; stroke-width: 2; stroke-linecap: round; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-weight: 500; }
.messages li.error { background: var(--neg-soft); }

/* ── графики (HTML) ── */
.chart { padding: 14px 20px 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.plot { position: relative; height: 230px; margin: 12px 0 0 46px; }
.plot .tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.plot .tick span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.plot .zero { border-top-color: var(--muted); opacity: .55; }
.cols { position: absolute; inset: 0; display: flex; gap: 2px; }
.col { flex: 1; position: relative; display: flex; justify-content: center; gap: 2px; cursor: default; }
.col:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); border-radius: 6px; }
.bar { position: absolute; width: min(22px, 34%); border-radius: 4px 4px 0 0; }
.bar.neg { border-radius: 0 0 4px 4px; }
.col .bar:nth-child(1):not(:only-child) { transform: translateX(calc(-50% - 1px)); }
.col .bar:nth-child(2) { transform: translateX(calc(50% + 1px)); }
.col .bar:only-child { width: min(26px, 60%); }
.bar.s1 { background: var(--s1); }
.bar.s2 { background: var(--s2); }
.xlabels { display: flex; gap: 2px; margin-left: 46px; margin-top: 6px; }
.xlabels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.dense .xlabels span:nth-child(even) { visibility: hidden; }
.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px;
  border-radius: 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); max-width: 260px;
}
.tip b { display: block; margin-bottom: 2px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }

.hbars { list-style: none; margin: 0; padding: 12px 20px 18px; display: grid; gap: 11px; }
.hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; font-size: 14px; }
.hbars .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .vl { font-variant-numeric: tabular-nums; text-align: right; }
.hbars .vl small { color: var(--muted); margin-left: 6px; font-size: 12px; }
.hbars .track { grid-column: 1 / -1; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbars .fill { height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }

/* ── отчётные таблицы ── */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.rep { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.rep th, .rep td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-2); }
.rep thead th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; z-index: 2; border-bottom: 1px solid var(--line);
}
.rep th:first-child, .rep td:first-child {
  position: sticky; left: 0; text-align: left; background: var(--surface); z-index: 1;
  min-width: 260px; max-width: 340px; white-space: normal; box-shadow: 1px 0 0 var(--line-2);
}
.rep thead th:first-child { background: var(--surface-2); z-index: 3; }
.rep td.tot, .rep th.tot { font-weight: 650; background: var(--surface-2); position: sticky; right: 0; z-index: 1; box-shadow: -1px 0 0 var(--line); }
.rep thead th.tot { z-index: 3; }
.rep tbody tr:hover td { background: var(--surface-2); }
.rep tr.section td { font-weight: 640; }
.rep tr.result td { font-weight: 700; border-top: 1px solid var(--line); background: var(--accent-soft); }
.rep tr.result td:first-child { background: var(--accent-soft); }
.rep tr.ratio td { color: var(--muted); font-size: 13px; }
.rep tr.balance td { color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
.rep tr.balance td:first-child { background: var(--surface-2); }
.rep td .zero { color: var(--line); }
.rep tr[data-parent] { display: none; }
.rep tr[data-parent].show { display: table-row; }
.tg {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.tg::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s; margin-right: 3px; flex: none;
}
.tg[aria-expanded="true"]::before { transform: rotate(45deg); }
.lvl1 td:first-child { padding-left: 26px; }
.lvl2 td:first-child { padding-left: 44px; }
.lvl3 td:first-child { padding-left: 62px; }
.lvl4 td:first-child, .lvl5 td:first-child { padding-left: 80px; }
.leaf { display: inline-block; padding-left: 16px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }

/* ── счета ── */
.acc-total { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; }
.acc-list { list-style: none; margin: 0; padding: 0; }
.acc-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.acc-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.acc-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acc-list .nm b { display: block; font-weight: 560; }
.acc-list .nm span { font-size: 13px; color: var(--muted); }
.acc-list .bal { text-align: right; font-weight: 640; font-variant-numeric: tabular-nums; }
.acc-list li.off { opacity: .62; }
details.more summary { cursor: pointer; padding: 12px 20px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line-2); list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

/* ── операции ── */
.filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(120px, 1fr)) auto; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .wide { grid-column: span 2; }
.filters .dt { display: flex; align-items: center; gap: 6px; min-width: 0; }
.filters .dt > span { color: var(--muted); font-size: 13px; flex: none; }
.filters .dt > input { flex: 1; min-width: 0; width: 100%; }
table.ops { width: 100%; border-collapse: collapse; font-size: 14px; }
.ops th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ops td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.ops tr.clickable { cursor: pointer; }
.ops tbody tr:hover td { background: var(--surface-2); }
.ops td.amt, .ops th.amt { text-align: right; white-space: nowrap; font-weight: 620; }
.ops .d { white-space: nowrap; color: var(--ink-2); }
.ops .what b { font-weight: 560; display: block; }
.ops .what .pill { margin-top: 4px; }
.ops .what span.c { color: var(--muted); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.pill.plan { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ── форма операции ── */
.form-card { max-width: 720px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 9px; cursor: pointer; font-weight: 560; color: var(--ink-2); text-align: center; padding: 4px 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg label:has(input[value="income"]:checked) { color: var(--pos); }
.seg label:has(input[value="outcome"]:checked) { color: var(--neg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.fgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 13px; font-weight: 560; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--neg); }
.field.has-err input, .field.has-err select { border-color: var(--neg); }
.amount-in { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 40px; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-actions .spacer { flex: 1; }
.only-move, .no-move { }
form[data-kind="move"] .no-move { display: none; }
form:not([data-kind="move"]) .only-move { display: none; }

/* ── вход ── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .brand { padding: 0 0 22px; }
.login form { display: grid; gap: 12px; }

/* ── 403 ── */
.center-msg { max-width: 520px; margin: 12vh auto; text-align: center; }

/* ── адаптив ── */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .wide { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; height: auto; width: min(290px, 86vw); z-index: 40; transform: translateX(-105%);
    padding-bottom: calc(14px + env(safe-area-inset-bottom));   /* тема и «Выйти» не прячутся под панель Safari */
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .2);
  }
  body.menu-open .side { transform: none; }
  body.menu-open .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 30; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; flex: 1; }
  .main { padding: 18px 16px 40px; }
  h1 { font-size: 21px; }
  .kpi-value { font-size: 24px; }
  .plot { margin-left: 40px; height: 200px; }
  .xlabels { margin-left: 40px; }
  .xlabels span:nth-child(even) { visibility: hidden; }
  .dense .xlabels span:not(:nth-child(3n+1)) { visibility: hidden; }
  .dense .xlabels span:nth-child(3n+1) { visibility: visible; }
  .rep th:first-child, .rep td:first-child { min-width: 170px; max-width: 200px; }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .ops .hide-sm { display: none; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .range { flex-wrap: wrap; }
  .card-pad, .chart, .card-head, .hbars { padding-left: 16px; padding-right: 16px; }
  .acc-list li { padding: 12px 16px; }
  .seg label { font-size: 14px; }
  .ops .hide-xs { display: none; }
  .rep td.tot, .rep th.tot { position: static; box-shadow: none; }
  .rep th:first-child, .rep td:first-child { min-width: 150px; max-width: 170px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── доступ, банки ── */
.bank-bal { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.scope-pick select { max-width: 240px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.list > li:first-child { border-top: 0; }
.list .nm b { display: block; font-weight: 600; }
.list .nm span { display: block; font-size: 13px; color: var(--muted); }
.list li.off { opacity: .55; }
.radios { display: grid; gap: 6px; }
.radios label, .checks label { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 36px; cursor: pointer; }
.radios input, .checks input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; padding: 6px 0 0 28px; }
.pw { font: 600 22px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); user-select: all; word-break: break-all; }
.status-ok { color: var(--pos); font-weight: 600; }
.status-err { color: var(--neg); font-weight: 600; }
table.links { width: 100%; border-collapse: collapse; font-size: 14px; }
.links th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
.links td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.links td.num { text-align: right; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 900px) { .links thead { display: none; } .links tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .links td { border: 0; padding: 2px 0; } .links td.num { text-align: left; } .links td.wide { grid-column: 1 / -1; } }

.ref-list li.root { background: var(--surface-2); }
.ref-list li.root b { text-transform: uppercase; letter-spacing: .05em; font-size: 12px; color: var(--muted); }
.form-card select[multiple] { min-height: 120px; }

/* неполные месяцы */
.col.partial .bar { opacity: .38; }
.rep th.partial, .rep td.partial { color: var(--muted); font-style: italic; }

/* ── Таблица финреза как в Phangaia ── */
.rep-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rep td.first { cursor: pointer; }
.rep thead th[data-ck] { cursor: pointer; }
.rep thead th[data-ck]:hover { color: var(--ink); }
.rep td.dk { cursor: pointer; }
.rep tr.hl td { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.rep thead th.colhl { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--accent); }
.rep tbody td.colhl { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.rep tbody tr.hl td.colhl { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }
/* окно операций — как в дашбордах резортов: карточка у верха таблицы, по ширине содержимого */
#opsPop { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: max-content; min-width: min(620px, 96%);
  max-width: min(900px, 96%); max-height: min(70vh, 520px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 44px rgba(0,0,0,.28);
  z-index: 70; padding: 12px 14px 10px; }
#opsPop[hidden], #opsScrim[hidden] { display: none; }
/* подложка прозрачная (как у резортов): нужна только чтобы нажатие мимо окна на iPhone его закрывало */
#opsScrim { position: fixed; inset: 0; background: transparent; z-index: 49; cursor: default; touch-action: none; }
body.poplock { overflow: hidden; }
#opsPop .ob { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#opsPop .oh { flex: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
#opsPop .oh b { font-size: 15px; font-weight: 800; }
#opsPop .oh .muted { font-size: 14px; }
#opsPop .oh [data-pop-close] { margin-left: auto; align-self: center; min-height: 32px; padding: 3px 10px; font-size: 12.5px; font-weight: 600;
  border-radius: 6px; color: var(--ink-2); }
#opsPop table { width: 100%; border-collapse: collapse; font-size: 14px; }
#opsPop th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; text-align: left; padding: 4px 8px;
  position: sticky; top: 0; background: var(--surface); z-index: 1; }
#opsPop th.r { text-align: right; }
#opsPop td { padding: 5px 8px; border-top: 1px solid var(--line-2); vertical-align: top; }
#opsPop td small { display: block; color: var(--muted); font-size: 12px; }
#opsPop td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
#opsPop td.n.neg { color: var(--neg); }
#opsPop td.d { white-space: nowrap; color: var(--muted); }
#opsPop td.d a { color: inherit; }
#opsPop td.d a:hover { color: var(--accent); }
#opsPop td.c { min-width: 200px; }
#opsPop .empty { color: var(--muted); padding: 6px 2px; }
#opsPop td.k, #opsPop td.n, #opsPop td.d, #opsPop th { white-space: nowrap; }
#opsPop td.c { white-space: normal; overflow-wrap: break-word; }
/* длинные банковские назначения — не больше двух строк, полный текст во всплывающей подсказке: в окно входит 5–7 операций, как у резортов */
#opsPop td.c .ct { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#opsPop td.c small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
/* узкий экран: окно карточками — только на обычной странице; в развороте содержимое повёрнуто и широкое */
@media (max-width: 700px) {
  body:not(.fvmode) #opsPop { width: 96%; min-width: 0; max-height: min(80vh, 560px); padding: 10px 12px; }
  body:not(.fvmode) #opsPop .oh [data-pop-close] { min-height: 40px; padding: 6px 14px; font-size: 13px; }
  body:not(.fvmode) #opsPop thead { display: none; }
  body:not(.fvmode) #opsPop tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
  body:not(.fvmode) #opsPop td { border: 0; padding: 0; }
  body:not(.fvmode) #opsPop td.d { order: 1; } body:not(.fvmode) #opsPop td.n { order: 2; }
  body:not(.fvmode) #opsPop td.k { order: 3; grid-column: 1 / -1; font-weight: 600; white-space: normal; }
  body:not(.fvmode) #opsPop td.c { order: 4; grid-column: 1 / -1; min-width: 0; font-size: 13px; }
}
/* сверка */
.feeds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 16px; }
.feeds form { margin-left: auto; }
.rep.plain td:first-child, .rep.plain th:first-child { position: static; }
.rep tr.badrow td { background: var(--neg-soft, #fdecea); }
/* закрытие месяцев и «Требует внимания» */
.rep th.final small { display: block; font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--pos); font-weight: 650; }
.attention { margin-bottom: 16px; border-left: 4px solid var(--warn); }
.attention.clear { border-left-color: var(--pos); }
.attention h2 { margin: 0 0 6px; font-size: 16px; }
.issues { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.issues li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.issues li::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--muted); align-self: center; }
.issues li.bad::before { background: var(--neg); }
.issues li.warn::before { background: var(--warn); }
.issues li span { flex: 1 1 240px; }
.issues li a { white-space: nowrap; font-weight: 600; padding: 9px 6px; margin: -9px -6px; }   /* зона нажатия ~40 px при той же вёрстке */
.month-card .mc-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.month-card h2 { margin: 0; }
.month-card.is-closed { border-left: 4px solid var(--pos); }
.pill.ok { background: color-mix(in srgb, var(--pos) 14%, var(--surface)); color: var(--pos); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.close-form { display: grid; gap: 10px; margin-top: 12px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.review .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.review-table td.wrap { white-space: normal; min-width: 280px; max-width: 520px; text-align: left; font-size: 13px; color: var(--ink-2); }
.review-table td select { min-width: 220px; }
.review-table td:first-child input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ═══ Оформление Phangaia (поверх базового) ═══ */
.num, .tnum, td.num, .kpi-value, #opsPop td.n, .acc-list .bal, .amount-in, .hbars .vl, .tip .row span:last-child,
.plot .tick span, .acc-total .kpi-value { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kpi-value small, .acc-total small { font-family: Manrope, system-ui, sans-serif; }
h1 { font-size: 25px; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-weight: 800; letter-spacing: -.005em; }
.page-head p { font-size: 14px; }
.card { border-color: var(--line-2); border-radius: 12px; }
.kpi-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 25px; font-weight: 600; letter-spacing: -.02em; }
.kpi-value small { font-size: 14px; font-weight: 600; margin-left: 5px; letter-spacing: 0; }
.kpi-sub { font-size: 13px; }
.btn { font-weight: 700; border-radius: 10px; transition: background .18s ease, border-color .18s ease, transform .12s ease; }
.btn:active { transform: translateY(1px); }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn-primary:hover { border-color: var(--accent); }
.chips a { font-weight: 600; transition: background .18s ease, color .18s ease; }
.nav a { font-weight: 600; transition: background .18s ease, color .18s ease; }
.nav-label { font-weight: 700; letter-spacing: .07em; }
.note { border-radius: 12px; }
select, input, textarea { font-family: inherit; }

/* таблица отчёта — как «Финансовый результат» */
.tablewrap { border-radius: 12px; }
table.rep { font-size: 14px; }
.rep th, .rep td { padding: 7px 10px; border-bottom-color: var(--line-2); }
.rep thead th { font-size: 12.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); border-bottom: 1px solid var(--line); }
.rep tbody tr { transition: background .15s ease; }
.rep tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.rep tr.hl td { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.rep tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.rep tr.section td { font-weight: 800; }
.rep tr.result td, .rep tr.result td:first-child { font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--line); }
.rep td.tot, .rep th.tot { background: var(--surface-2); font-weight: 800; }
.rep td.neg, .rep .neg { color: var(--neg); }
.rep td .zero { color: var(--line); }
.rep .tg { font-weight: inherit; }
.rep tr.lvl1 td:first-child, .rep tr.lvl2 td:first-child, .rep tr.lvl3 td:first-child { font-size: 13.5px; color: var(--ink-2); }

/* разворот на весь экран (как в Phangaia): на узком экране содержимое поворачивается на 90° */
.fabhost { position: relative; }
.fab-exp { position: absolute; top: 8px; right: 8px; z-index: 6; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border-radius: 10px; cursor: pointer; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  border: 1px solid var(--line); box-shadow: 0 6px 18px -8px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(-4px) scale(.96); pointer-events: none; transition: opacity .22s ease, transform .22s ease; }
.fab-exp.on, .fabhost:hover .fab-exp { opacity: 1; transform: none; pointer-events: auto; }
.fab-exp:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.fab-exp:focus-visible { opacity: 1; transform: none; pointer-events: auto; outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .fab-exp { opacity: 1; transform: none; pointer-events: auto; } }
#fullView { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: none; }
#fullView.on { display: block; animation: fvIn .22s var(--ease); }
@keyframes fvIn { from { opacity: 0; } to { opacity: 1; } }
/* разворот открыт: он и есть страница — в обычном потоке, высотой в экран; остальное скрыто (см. fullOpen в app.js) */
body.fvmode > :not(#fullView):not(#opsPop):not(#opsScrim):not(script) { display: none !important; }
body.fvmode #fullView { position: relative; inset: auto; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
/* Размер и поворот разворота задаёт CSS, а не скрипт: при физическом повороте телефона iPhone отдаёт
   в resize ещё старые innerWidth/innerHeight, и рассчитанный скриптом разворот оставался «вертикальным» —
   вылезал за экран вместе с кнопкой «Свернуть», экран выглядел зависшим. Медиазапрос меняется вместе с экраном. */
#fullView .rotor { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); display: flex; flex-direction: column; overflow: hidden;
  width: 100vw; height: 100vh; height: 100dvh;
  --pt: calc(6px + var(--sat)); --pr: calc(8px + var(--sar)); --pb: calc(4px + var(--sab)); --pl: calc(8px + var(--sal));
  padding: var(--pt) var(--pr) var(--pb) var(--pl); }
@media (orientation: portrait) and (max-width: 699.98px) {
  #fullView .rotor { width: 100vh; width: 100dvh; height: 100vw; transform: translate(-50%,-50%) rotate(90deg);
    --pt: calc(6px + var(--sar)); --pr: calc(4px + var(--sab)); --pb: calc(6px + var(--sal)); --pl: calc(8px + var(--sat)); }
}
#fullView .fv-head { display: flex; align-items: center; gap: 10px; min-height: 44px; flex: none; }
#fullView .fv-head b { font-size: 15px; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fullView .fv-close { position: static; opacity: 1; transform: none; pointer-events: auto; width: 44px; height: 44px; border-radius: 12px; }
#fullView .fv-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#fullView .fv-slot > .card { flex: 1; min-height: 0; display: flex; flex-direction: column; box-shadow: none; }
/* кнопка разворота оборачивает таблицу в .fabhost — он тоже должен сжиматься, иначе таблица растягивается
   на всю высоту (4–5 тыс. px), вылезает за экран и не прокручивается: на iPhone разворот «висел» */
#fullView .fabhost { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#fullView .tablewrap { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
#fullView .fab-exp:not(.fv-close) { display: none; }
#fullView .rep-tools > .muted { display: none; }   /* подсказка съедает треть высоты повёрнутого экрана */
@media (prefers-reduced-motion: reduce) { #fullView.on { animation: none; } .fab-exp { transition: opacity .01s; } }

/* таблица отчёта на телефоне не растягивает страницу — прокручивается внутри, разворот — кнопкой */
@media (max-width: 600px) {
  /* только отчётные таблицы (их JS оборачивает в .fabhost с кнопкой разворота); списки операций
     и «Расходы кассы» листаются страницей, без окошка с отдельной прокруткой */
  .card > .fabhost > .tablewrap { max-height: min(60vh, 520px); overflow: auto; }
  #fullView .card > .fabhost > .tablewrap { max-height: none; }
}
/* окно операций — плавное появление */
#opsPop:not([hidden]) { animation: popIn .18s var(--ease); }
@keyframes popIn { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { #opsPop:not([hidden]) { animation: none; } }

/* «Расходы кассы» на телефоне — карточками, без прокрутки вбок */
@media (max-width: 600px) {
  .review-table thead { display: none; }
  .review-table, .review-table tbody { display: block; }
  .review-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center;
    padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
  .review-table td { border: 0; padding: 0; }
  .review-table td.wrap { grid-column: 1 / -1; min-width: 0; max-width: none; }
  .review-table td:last-child { grid-column: 1 / -1; }
  .review-table td select { width: 100%; min-width: 0; }
  .review-table td.num { text-align: right; }
  .review-table td:first-child, .review-table th:first-child { min-width: 0; max-width: none; position: static; box-shadow: none; }
}
.review-table th:first-child, .review-table td:first-child { min-width: 0; width: 44px; max-width: 44px; position: static; }

/* ═══ Таблица отчёта один в один с «Финансовым результатом» дашбордов резортов (просьба владельца 26.11.2026).
   Образец — ~/phangaia-dash/template.html (.ctl, .seggroup, .finres, #opsPop). ═══ */
.rep-card { background: none; border: 0; box-shadow: none; border-radius: 0; position: relative; }
.rep-card > .rep-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 0 0 10px; border: 0;
  justify-content: flex-start; font-size: 13px; }
.rep-card .seggroup { flex: none; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
/* класс .seg занят переключателем в форме операции (grid) — здесь сбрасываем его раскладку */
.rep-card .seg { display: inline-flex; align-items: center; justify-content: center; gap: 0; grid-template-columns: none; box-shadow: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: var(--surface); border: 0; border-radius: 0;
  padding: 7px 10px; min-height: 36px; white-space: nowrap; cursor: pointer; transition: background .18s ease, color .18s ease; }
.rep-card .seg:hover { background: var(--surface-2); }
.rep-card .seg[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.rep-card .seg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rep-card .seggroup .sm { display: none; }
.rep-card .selwrap { position: relative; display: inline-flex; margin-left: auto; }
.rep-card .selwrap select { -webkit-appearance: none; appearance: none; width: auto; min-height: 36px; line-height: normal; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 30px 7px 10px; cursor: pointer; }
.rep-card .selwrap::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; pointer-events: none;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-70%) rotate(45deg); }
.rep-card .tablewrap { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow);
  max-height: min(72vh, 660px); overflow: auto; }
.rep-card .rep-hint { margin: 8px 2px 0; font-size: 13px; color: var(--muted); }

.rep-card table.rep { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.rep-card .rep th, .rep-card .rep td { padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid var(--line-2); }
.rep-card .rep thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-size: 12.5px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; text-align: right; border-bottom: 1px solid var(--line); }
.rep-card .rep thead th small { display: block; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.rep-card .rep td { text-align: right; font-family: inherit; font-variant-numeric: tabular-nums; }
/* колонка названий — как у резортов: липкая, в одну строку с многоточием, тонкая линия справа */
.rep-card .rep th.first, .rep-card .rep td.first { position: sticky; left: 0; text-align: left; background: var(--surface); z-index: 2;
  min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; box-shadow: none;
  padding-left: 22px; }
.rep-card .rep thead th.first { z-index: 4; background: var(--surface-2); padding-left: 10px; }
.rep-card .rep th.first::after, .rep-card .rep td.first::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: var(--line-2); }
.rep-card .rep .leaf { display: inline; padding: 0; }
/* кнопка-название раскрываемой строки: блоком, чтобы длинное название тоже обрезалось многоточием */
.rep-card .rep .tg { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
  font: inherit; font-weight: inherit; color: inherit; }
/* без стрелок раскрытия, как у резортов: ветки открывает «Подробно»; тире подстроки — в левом поле */
.rep-card .rep tr.lvl1 td.first { padding-left: 36px; }
.rep-card .rep tr.lvl2 td.first { padding-left: 50px; }
.rep-card .rep tr.lvl3 td.first { padding-left: 64px; }
.rep-card .rep tr.lvl4 td.first, .rep-card .rep tr.lvl5 td.first { padding-left: 78px; }
.rep-card .rep tr[data-parent] td.first .leaf::before { content: ""; position: absolute; top: 50%; width: 5px; height: 1px; background: var(--line); left: 24px; }
.rep-card .rep tr.lvl2 td.first .leaf::before { left: 38px; } .rep-card .rep tr.lvl3 td.first .leaf::before { left: 52px; }
.rep-card .rep tr.lvl4 td.first .leaf::before, .rep-card .rep tr.lvl5 td.first .leaf::before { left: 66px; }
.rep-card .rep tr[data-parent] td { font-size: 13px; color: var(--ink-2); }
.rep-card .rep tr[data-parent] td.first { font-weight: 500; }
.rep-card .rep tr.lvl1 td.first, .rep-card .rep tr.lvl2 td.first, .rep-card .rep tr.lvl3 td.first { font-size: 13px; }
.rep-card .rep tr.section td { font-weight: 400; } .rep-card .rep tr.section td.first { font-weight: 600; }
.rep-card .rep tr.result td, .rep-card .rep tr.result td.first { font-weight: 800; background: var(--surface-2); border-top: 0; }
.rep-card .rep tr.balance td, .rep-card .rep tr.balance td.first { font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.rep-card .rep tr.ratio td { color: var(--ink); font-size: 14px; }
.rep-card .rep td.tot, .rep-card .rep th.tot { position: static; box-shadow: none; background: var(--surface-2); font-weight: 800; }
.rep-card .rep thead th.tot { position: sticky; top: 0; right: auto; z-index: 3; }
/* минус красным в любой строке, как у резортов (у подстрок и остатков свой серый цвет — перебиваем) */
.rep-card .rep td.neg, .rep-card .rep tr[data-parent] td.neg, .rep-card .rep tr.balance td.neg, .rep-card .rep tr.ratio td.neg { color: var(--neg); }
.rep-card .rep td .zero { color: var(--line); }
.rep-card .rep th.partial, .rep-card .rep td.partial { font-style: normal; }
.rep-card .rep th.partial, .rep-card .rep td.partial:where(:not(.neg)) { color: inherit; }
.rep-card .rep thead th.partial { color: var(--muted); }
.rep-card .rep tbody td[data-ck], .rep-card .rep tbody td.first { cursor: pointer; }
.rep-card .rep tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.rep-card .rep tbody tr.hl td { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.rep-card .rep tbody tr.hl td.first { box-shadow: inset 3px 0 0 var(--accent); }
.rep-card .rep thead th.colhl { background: color-mix(in srgb, var(--accent) 24%, var(--surface-2)); color: var(--accent); }
.rep-card .rep tbody td.colhl { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.rep-card .rep tbody tr.hl td.colhl { background: color-mix(in srgb, var(--accent) 26%, var(--surface)); }

/* разворот — как у резортов: без заголовка, кнопка «Свернуть» в конце ряда кнопок таблицы */
#fullView .fv-head.empty { display: none; }
#fullView .rep-card { flex: 1; min-height: 0; }
#fullView .rep-card > .rep-tools { padding: 0 0 6px; }
#fullView .rep-card > .rep-tools .fv-close { margin-left: 4px; width: 44px; height: 44px; border-radius: 12px; flex: none; }
#fullView .rep-card .tablewrap { max-height: none; border-radius: 10px; }
#fullView .rep-hint { display: none; }
#fullView #opsPop { max-height: calc(100% - 16px); }

@media (max-width: 600px) {
  .rep-card > .rep-tools { gap: 6px; }
  .rep-card .seggroup .lg { display: none; } .rep-card .seggroup .sm { display: inline; }
  .rep-card .seg { padding: 6px 9px; }
  .rep-card .selwrap select { padding-top: 6px; padding-bottom: 6px; min-height: 34px; }
  .rep-card > .fabhost > .tablewrap { max-height: min(52vh, 430px); }
  .rep-card .rep th, .rep-card .rep td { padding: 6px 7px; font-size: 13px; }
  .rep-card .rep th.first, .rep-card .rep td.first { max-width: 170px; padding-left: 22px; }
  .rep-card .rep thead th.first { padding-left: 7px; }
}

/* разворот как у резортов: короткая таблица тянется на всю высоту (лишнее делят строки), а на телефоне
   в портрете содержимое повёрнуто и широкое — мелкие «телефонные» размеры к нему не применяем */
#fullView .rep-card .tablewrap > table.rep { height: 100%; }
#fullView .rep-card .rep thead tr { height: 1px; }
@media (max-width: 600px) {
  body.fvmode .rep-card .rep th, body.fvmode .rep-card .rep td { padding: 7px 10px; font-size: 14px; }
  body.fvmode .rep-card .rep thead th { font-size: 12.5px; }
  body.fvmode .rep-card .rep th.first, body.fvmode .rep-card .rep td.first { max-width: 260px; padding-left: 22px; }
  body.fvmode .rep-card .rep thead th.first { padding-left: 10px; }
}
/* низкий экран (телефон горизонтально): комментарий в одну строку — в окно входит больше операций */
/* ячейка width: 100% + max-width: 0 — строка без переносов не раздувает колонку и обрезается многоточием
   по её ширине (так многоточие рисует и Safari) */
@media (max-height: 500px) { #opsPop { width: min(900px, 96%); } #opsPop td.c { width: 100%; max-width: 0; min-width: 0; }
  #opsPop td.c .ct, #opsPop td.c small { display: block; -webkit-line-clamp: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
