    :root {
 --pos: #1a8d3e; /* positive / inflow amounts */
 --neg: #d11; /* negative / outflow amounts, reconcile badge */
            --app-border: color-mix(in srgb,var(--tg-theme-hint-color,#89909a) 20%,transparent);
            --app-border-strong: color-mix(in srgb,var(--tg-theme-hint-color,#89909a) 34%,transparent);
            --app-surface: color-mix(in srgb,var(--tg-theme-bg-color,#fff) 94%,var(--tg-theme-secondary-bg-color,#f1f1f1));
            --app-surface-soft: color-mix(in srgb,var(--tg-theme-secondary-bg-color,#f1f1f1) 68%,transparent);
            --app-accent-soft: color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 11%,transparent);
            --app-shadow: 0 8px 30px rgba(18,31,53,.065);
            --app-radius: 14px;
            --app-control-height: 44px;
            --app-header-edge: color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 28%,var(--app-border-strong));
            --app-header-field: color-mix(in srgb,var(--tg-theme-bg-color,#fff) 94%,var(--tg-theme-secondary-bg-color,#f1f1f1));
            --app-header-ink: color-mix(in srgb,var(--tg-theme-text-color,#111) 88%,var(--tg-theme-hint-color,#68717d)); }
 /* Pin UA widgets to the resolved app theme (never dual light/dark). */
    html { color-scheme: light; }
    html[data-theme="light"] { color-scheme: light; }
    html[data-theme="dark"] { color-scheme: dark; }
    body { font-family: -apple-system, system-ui, sans-serif; margin: 0; font-size: 14px;
           background: var(--tg-theme-bg-color, #fff); color: var(--tg-theme-text-color, #111);
 /* respect the notch / home indicator on phones */
           padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
                    calc(16px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
 /* iOS auto-zooms a focused input whose font is < 16px — kill that jump on FORM
 inputs AND on every editable table cell (rate board, shift recount, wallet/referral
 edits). Width stays in ch so fields stay character-bounded; the table scrolls
 horizontally anyway, so the only effect is a slightly larger, more tappable cell. */
    #f-q, #docs-q, #wc-ref,
    td input, td select, td textarea { font-size: 16px; }
 #hdr { display:grid; grid-template-columns:minmax(0,1fr) auto auto;
           grid-template-areas:"tenant search tools" "status status status";
           align-items:center; gap:5px 7px; margin-bottom:7px; padding:6px;
           border:1px solid var(--app-header-edge); border-radius:var(--app-radius);
           background:linear-gradient(125deg,
             color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 10%,var(--app-surface)),
             var(--app-surface) 55%,
             color-mix(in srgb,var(--tg-theme-hint-color,#89909a) 6%,var(--app-surface)));
           box-shadow:0 9px 26px rgba(18,31,53,.09), inset 0 1px 0 rgba(255,255,255,.55); }
 /* §audit rank-11: the tenant chip ellipsizes on narrow phones so it never squeezes/clips the
 action buttons; the tools cluster is fixed-size and never shrinks. */
 #tenant { grid-area:tenant; font-weight:700; color:var(--app-header-ink); min-width:0;
        overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
 /* §ui: cabinet switcher reads as a tappable workspace chip (Slack/Notion-style). */
    .tn-switch { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:9px;
        background:var(--app-header-field); border:1px solid var(--app-border-strong); max-width:100%;
        white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .tn-caret { opacity:.75; font-size:11px; }
 #hdr-tools { grid-area:tools; display:inline-flex; align-items:center; gap:4px; justify-self:end; }
    .hdr-btn {
        display:inline-grid; place-items:center; min-width:var(--app-control-height);
        min-height:var(--app-control-height); padding:0; border:1px solid var(--app-border); border-radius:11px;
        color:var(--tg-theme-text-color,#111); background:var(--app-header-field); font:inherit; font-size:15px; cursor:pointer;
    }
    .hdr-icon-btn {
        display:inline-flex; align-items:center; justify-content:center;
        padding:0; aspect-ratio:1; box-sizing:border-box;
    }
    .hdr-btn-glyph {
        display:block; line-height:1; font-size:15px;
        transform:translate(0.04em, 0);
    }
    .hdr-btn:hover { border-color:var(--app-border-strong); background:var(--tg-theme-bg-color,#fff); }
    .context-switch-button {
        display:inline-flex; align-items:center; justify-content:center; gap:6px;
        width:auto; max-width:min(240px,32vw); padding:0 10px; font-weight:650;
    }
    .context-switch-label {
        min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
    }
    .hdr-btn:focus-visible, #search-btn.hdr-search:focus-visible, .appearance-segment:focus-visible {
        outline:2px solid var(--tg-theme-button-color,#3390ec); outline-offset:2px;
    }
    .appearance-toggle {
        display:inline-grid; grid-auto-flow:column; grid-auto-columns:1fr; align-items:center;
        min-height:36px; padding:3px; box-sizing:border-box;
        border:1px solid var(--app-border-strong); border-radius:11px;
        color:var(--tg-theme-text-color,#111); background:var(--app-header-field);
        font:inherit; font-size:11px; font-weight:650;
    }
    .appearance-segment {
        display:inline-flex; align-items:center; justify-content:center; gap:4px;
        min-height:36px; padding:0 8px; border-radius:8px; white-space:nowrap;
        border:0; background:transparent; font:inherit; font-weight:inherit; cursor:pointer;
        color:color-mix(in srgb,var(--tg-theme-text-color,#111) 72%,var(--tg-theme-hint-color,#68717d));
        transition:background .16s ease,color .16s ease,box-shadow .16s ease,opacity .16s ease;
    }
    .appearance-segment:not(.active) { opacity:.95; }
    .appearance-segment.active {
        opacity:1;
        color:var(--ui-on-accent,#fff);
        background:var(--ui-accent-solid,color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 44%,#041525));
        box-shadow:0 2px 7px color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 30%,transparent);
    }
    .appearance-icon { font-size:14px; line-height:1; flex:0 0 auto; }
    .hdr-appearance { min-height:var(--app-control-height); }
 #hdr-tools .appearance-theme .appearance-segment { min-width:58px; padding:0 7px; }
 #hdr-tools .appearance-mode { min-width:108px; }
    @media (max-width:520px) {
        .context-switch-button { max-width:42vw; min-height:44px; }
 #hdr-tools .appearance-segment:not(.active) .appearance-label { display:none; }
 #hdr-tools .appearance-mode .appearance-segment,
 #hdr-tools .appearance-theme .appearance-segment { min-width:34px; padding:0 6px; }
 #hdr-tools .appearance-mode { min-width:0; }
        body.pro #hdr {
            grid-template-columns:minmax(0,1fr);
            grid-template-areas:"tenant" "tools" "search" "status";
        }
        body.pro #hdr-tools {
            width:100%; min-width:0; max-width:100%; justify-self:stretch;
            justify-content:flex-end; flex-wrap:wrap;
        }
        body.pro #search-btn.hdr-search { width:100%; min-width:0; max-width:100%; }
    }
 /* The command palette is a stable header field, not a floating low-contrast emoji. */
 #search-btn.hdr-search {
        grid-area:search; display:inline-grid; grid-template-columns:auto minmax(0,1fr) auto;
        align-items:center; gap:7px; justify-self:stretch; width:clamp(210px,32vw,420px);
        min-height:var(--app-control-height); padding:0 9px; box-sizing:border-box;
        border:1px solid var(--app-border-strong); border-radius:11px;
        color:color-mix(in srgb,var(--tg-theme-text-color,#111) 78%,var(--tg-theme-hint-color,#68717d));
        background:var(--app-header-field);
        font:inherit; font-size:12px; text-align:left; cursor:pointer;
    }
    .hdr-search-icon { font-size:19px; line-height:1; color:var(--tg-theme-text-color,#111); }
    .hdr-search-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .hdr-search-shortcut {
        min-width:31px; padding:2px 5px; border:1px solid var(--app-border);
        border-radius:6px; color:color-mix(in srgb,var(--tg-theme-text-color,#111) 74%,var(--tg-theme-hint-color,#68717d));
        background:var(--tg-theme-bg-color,#fff); font:inherit; font-size:9px; text-align:center;
    }
 #status {
        grid-area:status; justify-self:start; max-width:100%;
        color:color-mix(in srgb,var(--tg-theme-text-color,#111) 82%,var(--tg-theme-hint-color,#777));
        font-size:11px; font-weight:560; white-space:nowrap;
        overflow:hidden; text-overflow:ellipsis;
        background:var(--app-header-field); border:1px solid var(--app-border); border-radius:8px; padding:3px 8px;
    }
 /* Pro system header: workspace, live context and tools share one calm information bar.
 Lite keeps the two-row mobile arrangement below. */
    body.pro #hdr {
        grid-template-columns:minmax(150px,1fr) minmax(220px,420px) minmax(0,.8fr) auto;
        grid-template-areas:"tenant search status tools";
        min-height:40px; padding:6px 7px;
        background:linear-gradient(120deg,
          color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 16%,var(--app-surface)),
          var(--app-surface) 48%,
          color-mix(in srgb,var(--tg-theme-secondary-bg-color,#f1f1f1) 76%,var(--app-surface)));
        box-shadow:0 10px 28px rgba(18,31,53,.10), inset 0 1px 0 rgba(255,255,255,.52);
        backdrop-filter:saturate(125%) blur(12px);
        -webkit-backdrop-filter:saturate(125%) blur(12px);
    }
    body.pro #tenant { display:flex; align-items:center; }
    body.pro #status { justify-self:start; align-self:center; padding:3px 7px; }
    body.pro #hdr-tools { gap:4px; }
    body.pro .hdr-btn { min-width:var(--app-control-height); min-height:var(--app-control-height); }
    @media (max-width:1100px) {
        body.pro #hdr {
            grid-template-columns:minmax(130px,1fr) minmax(210px,360px) auto;
            grid-template-areas:"tenant search tools";
        }
        body.pro #hdr #status { display:none; }
    }
    @media (max-width:700px) {
        body.pro #hdr {
            grid-template-columns:minmax(0,1fr) auto;
            grid-template-areas:"tenant tools" "search search" "status status";
        }
        body.pro #search-btn.hdr-search { width:100%; min-height:42px; }
    }
 #status:empty { display:none; }
    .wrap { overflow:auto; -webkit-overflow-scrolling:touch; }
    table { border-collapse: collapse; width: max-content; min-width:100%; }
 /* §visual-refresh (owner 2026-07-04): drop the per-cell grid («Excel» look) — only a faint row
 divider + roomier padding + tabular figures, so tables read as a modern list. */
    th, td { border: none; border-bottom: 1px solid var(--tg-theme-hint-color,#ececec);
        padding: 8px 11px; white-space: nowrap; text-align: right;
        font-variant-numeric: tabular-nums; }
    th { position: sticky; top: 0; background: var(--tg-theme-secondary-bg-color,#f6f6f6);
         font-weight:600; font-size:12px; border-bottom:1px solid var(--tg-theme-hint-color,#e0e0e0); }
 /* Finance readability floor in Pro: keep 10-11px only for Deals registry. */
    body.pro #grid:not(.deals-registry) > thead > tr > th,
    body.pro #grid:not(.deals-registry) > tbody > tr > td {
        padding:6px 9px; font-size:12px; line-height:1.3;
    }
    body.pro #grid:not(.deals-registry) > thead > tr > th { font-size:11px; }
    body.pro #grid tbody table th, body.pro #grid tbody table td {
        font-size:12px; padding:5px 7px;
    }
 /* §design-frame (owner 2026-07-05): the borderless list went too far — columns blended and the
 table had no perimeter. Give the MAIN data grid a rounded, softly-elevated frame and GENTLE
 vertical dividers between its own columns (theme-neutral rgba so it reads clean in light+dark,
 not a heavy «Excel» grid). Scoped to #grid's own rows via the child combinator so nested editor
 tables (Маржа/Тарифы cells) and single-cell prose rows are untouched. */
 #grid { border-collapse: separate; border-spacing: 0; overflow: hidden;
        border: 1px solid var(--tg-theme-hint-color,#e2e2e2); border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,.05); }
 #grid > thead > tr > th:not(:last-child),
 #grid > tbody > tr > td:not(:last-child) { border-right: 1px solid rgba(128,128,128,.13); }
 /* last row's divider is redundant against the frame's bottom edge */
 #grid > tbody > tr:last-child > td { border-bottom: none; }
    td.txt, th.txt { text-align: left; }
    td.ro { color:var(--tg-theme-hint-color,#888); }
 #grid td input, .mini td input { width: 9ch; border:none; background:transparent; color:inherit;
            font: inherit; text-align:right; }
 #grid td input.cm, .mini td input.cm { width: 16ch; text-align:left; }
 /* Rate-board cells must LOOK editable (the default table input is borderless). */
    input.rbi { border:1px solid var(--tg-theme-hint-color,#9aa); background: var(--tg-theme-bg-color,#fff);
            border-radius:6px; padding:4px 5px; text-align:right; }
    input.rbi:focus { outline:none; border-color: var(--tg-theme-link-color,#3390ec); }
 /* Overview header: headline live figures, each tappable. */
    .ovh { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
    .tab { min-height:38px; }
    .tab .ti { font-size:15px; line-height:1; }
    .ovt { flex:1 1 auto; min-width:88px; border:none; border-radius:10px; padding:8px 5px; cursor:pointer; font:inherit;
           background: var(--tg-theme-secondary-bg-color,#f1f1f1); color: var(--tg-theme-text-color,#000); text-align:center; }
    .ovl { font-size:11px; opacity:.7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .ovv { font-size:16px; font-weight:700; margin-top:2px; white-space:nowrap;
           overflow:hidden; text-overflow:ellipsis; max-width:100%; }
 /* §audit rank-5: the «Итого ≈USDT» net-worth hero — full-width, gradient, the one big number on top. */
    .ovt-hero { flex:1 1 100%; background:linear-gradient(135deg,#3390ec,#1f6fd0); color:#fff; padding:11px 12px; text-align:left; }
    .ovt-hero .ovl { opacity:.85; font-size:12px; }
    .ovt-hero .ovv { font-size:26px; }
    input:focus, select:focus { outline: 1px solid var(--tg-theme-link-color,#3390ec); border-radius:3px; }
 #grid td select, .mini td select {
        border:none; background:transparent; color:inherit; font:inherit; max-width: 14ch;
    }
    .ok { background: #2ecc7133; } .err { background: #e74c3c44; }
    td.acts { white-space: nowrap; text-align: center; }
    button.act { font: inherit; padding: 2px 7px; margin: 0 1px; border: none; border-radius: 6px;
        cursor: pointer; background: var(--tg-theme-secondary-bg-color,#e6e6e6); color: inherit; }
    body.lite button.act { min-height: 38px; padding: 8px 10px; }
    body.lite .dc-sel { width: 22px; height: 22px; }
    button.act:disabled { opacity: .5; }
 /* Main navigation scales as one framed deck. Hidden RBAC items consume no cells. */
 #tabs {
        display:grid; grid-template-columns:repeat(auto-fit,minmax(96px,1fr)); gap:5px;
        margin-bottom:8px; padding:4px; border:1px solid var(--app-border); border-radius:var(--app-radius);
        background:var(--app-surface); box-shadow:0 4px 18px rgba(18,31,53,.04);
    }
    .tab {
        display:inline-flex; align-items:center; justify-content:center; gap:6px; width:100%;
        min-height:var(--app-control-height); padding:6px 9px; box-sizing:border-box;
        border:1px solid transparent; border-radius:10px; cursor:pointer;
        background:transparent; color:var(--tg-theme-text-color,#111); font:inherit; font-size:12px;
        font-weight:620; white-space:nowrap;
    }
    .tab:hover { background:var(--app-surface-soft); }
    .tab:focus-visible { outline:2px solid var(--tg-theme-button-color,#3390ec); outline-offset:1px; }
    .tab.active {
        background:var(--ui-accent-solid,color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 44%,#041525));
        color:var(--ui-on-accent,#fff); font-weight:700;
        box-shadow:0 5px 14px color-mix(in srgb,var(--tg-theme-button-color,#3390ec) 24%,transparent);
    }
 /* Workspace focus mode: less vertical chrome across non-dashboard pages. */
    body.pro.focus-workspace #hdr { margin-bottom:4px; }
    body.pro.focus-workspace #status { display:none; }
    body.pro.focus-workspace[data-view="dash"] #status { display:inline-block; }
    body.pro.focus-workspace #tabs { gap:4px; margin-bottom:5px; }
    /* Compact Pro chrome budget: tabsBottom ≤120 at 1024. 44px is Lite/touch. */
    body.pro.focus-workspace #tabs .tab { min-height:38px; padding:6px 10px; }
    body.pro.focus-workspace #new-wrap { margin-bottom:4px !important; }
    body.pro.focus-workspace #filters { gap:4px; margin-bottom:4px; }
    body.pro.focus-workspace #deal-bar { margin-bottom:4px !important; }
    body.pro.focus-workspace #refs-bar { margin-bottom:4px; }
    body.pro.focus-workspace .deals-ctx { display:none; }
    body.pro.focus-workspace #led-bar { margin-top:0; }
    body.pro.focus-workspace .led-ctx { display:none; }
    body.pro.focus-workspace .led-shortcuts,
    body.pro.focus-workspace .led-quick-row { display:none; }
    body.pro.focus-workspace[data-view="dash"] .dash-quick-row,
    body.pro.focus-workspace[data-view="dash"] .dash-today-row { display:none !important; }
    body.pro.focus-workspace[data-view="dash"] .dash-period-row { margin-bottom:4px !important; }
    body.pro.focus-workspace[data-view="dash"] .dash-period-row > label { flex:0 0 auto; }
    body.pro.focus-workspace[data-view="dash"] .dash-period-row > .cm { max-width:13ch; }
    body.pro.focus-workspace[data-view="dash"] .ovh { margin-bottom:4px; }
    body.pro.focus-workspace[data-view="dash"] .cards { margin-top:4px; }
    body.pro.focus-workspace[data-view="dash"] .dash-sec { margin-top:6px; }
 /* Phone (lite): #tabs becomes a fixed native-style BOTTOM nav bar (max 5 slots,
 Telegram-style) — Дашборд centred and raised; overflow goes to «⋯ Ещё». */
    body.lite #tabs { display:flex; position:fixed; left:0; right:0; bottom:0; z-index:40;
        gap:0; margin:0; flex-wrap:nowrap; overflow:visible;
        background:var(--tg-theme-bg-color,#fff);
        border-top:1px solid var(--app-border, var(--tg-theme-hint-color,#e2e2e2));
        border-right:0; border-bottom:0; border-left:0; border-radius:0; box-shadow:0 -8px 24px rgba(18,31,53,.08);
        padding:5px max(4px,env(safe-area-inset-left))
                calc(5px + env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-right)); }
    body.lite #tabs .tab { flex:1 1 0; min-width:54px; min-height:44px;
        flex-direction:column; gap:2px; padding:5px 2px; border-radius:10px;
        background:none; color:var(--ui-muted-strong, #3f4b5a);
        font-size:10px; line-height:1.1; font-weight:500; white-space:nowrap; }
    body.lite #tabs .tab .ti { font-size:21px; }
    body.lite #tabs .tab .tl {
        max-width:100%; overflow:hidden; text-overflow:ellipsis;
        font-size:9px; line-height:1.1; white-space:normal;
    }
    body.lite #tabs .tab.active { background:none; font-weight:600;
        color:var(--tg-theme-link-color,#3390ec); }
 /* keep only the 4 primary slots + «Ещё» in the bar; the rest live in the sheet */
    body.lite #tab-b2b, body.lite #tab-mailings, body.lite #tab-settings, body.lite #tab-platform,
    body.lite #tab-docs { display:none !important; }
    body.lite #tab-more { display:inline-flex !important; }
    @media (max-width:920px) and (min-width:701px) {
        body.pro #tabs { grid-template-columns:repeat(4,minmax(0,1fr)); }
    }
 /* order so Дашборд sits in the middle */
    body.lite #tab-deals { order:1; } body.lite #tab-ledger { order:2; }
    body.lite #tab-dash { order:3; } body.lite #tab-refs { order:4; }
    body.lite #tab-more { order:5; }
 /* centred Дашборд — a gentle accent circle (not a big FAB) */
    body.lite #tab-dash .ti { background:var(--tg-theme-button-color,#3390ec);
        color:var(--tg-theme-button-text-color,#fff); width:34px; height:34px;
        border-radius:50%; display:flex; align-items:center; justify-content:center;
        margin-top:-6px; box-shadow:0 2px 6px rgba(51,144,236,.35); font-size:18px; }
    body.lite #tab-dash.active .ti { box-shadow:0 2px 9px rgba(51,144,236,.55); }
 /* «⋯ Ещё» bottom sheet */
 #more-sheet { position:fixed; left:0; right:0;
        bottom:calc(60px + env(safe-area-inset-bottom)); z-index:60;
        background:var(--tg-theme-bg-color,#fff); border-radius:16px 16px 0 0;
        box-shadow:0 -4px 20px rgba(0,0,0,.18); padding:8px 10px 12px; }
 /* Pro has no bottom bar — sit the sheet at the bottom edge */
    body.pro #more-sheet { bottom: env(safe-area-inset-bottom); }
 #more-sheet .ms-item { display:flex; align-items:center; gap:12px; width:100%;
        font:inherit; font-size:15px; border:none; background:none; color:inherit;
        padding:13px 10px; border-radius:10px; cursor:pointer; text-align:left; }
 #more-sheet .ms-item:active { background:var(--tg-theme-secondary-bg-color,#f1f1f1); }
 #more-sheet .ms-ico { font-size:20px; width:26px; text-align:center; }
 /* keep page content clear of the fixed bottom bar */
    body.lite {
        padding-bottom:calc(86px + env(safe-area-inset-bottom));
        scroll-padding-bottom:calc(86px + env(safe-area-inset-bottom));
    }
    body.lite #hdr {
        grid-template-columns:minmax(0,1fr) auto auto;
        grid-template-areas:"tenant search tools" "status status status";
        padding:6px;
    }
    body.lite #search-btn.hdr-search {
        width:var(--app-control-height); min-width:var(--app-control-height);
        min-height:var(--app-control-height); padding:0;
        grid-template-columns:auto; justify-self:end;
    }
    body.lite .hdr-search-shortcut,
    html.tg-webapp .hdr-search-shortcut { display:none; }
    @media (hover: none) and (pointer: coarse) {
        .hdr-search-shortcut { display:none; }
    }
    @media (max-width:390px) {
        .hdr-search-shortcut { display:none; }
 #hdr-tools { gap:4px; }
        .hdr-btn { min-width:36px; min-height:36px; }
        body.lite #hdr-tools .hdr-icon-btn,
        body.lite #hdr-tools .help-q {
            min-width:var(--app-control-height);
            min-height:var(--app-control-height);
        }
    }
    body.lite #search-btn.hdr-search {
        width:var(--app-control-height); min-width:var(--app-control-height); max-width:none;
        grid-template-columns:auto; justify-self:end;
    }
    body.lite .hdr-search-label { display:none; }
    body.lite .hdr-appearance { display:none !important; }
    #appearance-btn { display:none; }
    body.lite #appearance-btn { display:inline-flex; }
    @media (max-width:700px) {
        .hdr-appearance { display:none !important; }
        #appearance-btn { display:inline-flex; }
        .hdr-search-shortcut { display:none; }
    }
    body.lite.deal-form-open #tabs {
        visibility:hidden; pointer-events:none;
    }
    .appearance-sheet { display:flex; flex-direction:column; gap:12px; padding:4px 2px 8px; }
    .appearance-sheet-row {
        display:flex; flex-direction:column; gap:6px;
    }
    .appearance-sheet-row > span {
        font-size:12px; font-weight:650;
        color:var(--ui-muted-strong, var(--tg-theme-hint-color,#555));
    }
    .appearance-sheet-intro {
        display:flex; flex-direction:column; gap:4px; font-size:13px;
    }
    .appearance-sheet-intro span {
        font-weight:400;
        color:var(--ui-muted-strong, var(--tg-theme-hint-color,#555));
    }

 /* Universal command palette. Geometry is theme-invariant; only tokens change. */
    .gs-search {
        display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:8px;
        min-height:46px; padding:0 11px; border:1px solid var(--app-border-strong);
        border-radius:12px; color:var(--tg-theme-hint-color,#68717d);
        background:var(--app-surface);
    }
    .gs-search:focus-within {
        border-color:var(--tg-theme-button-color,#3390ec);
        box-shadow:0 0 0 3px var(--app-accent-soft);
    }
    .gs-search > span { font-size:21px; color:var(--tg-theme-text-color,#111); }
    .gs-search input {
        width:100%; min-width:0; min-height:44px; padding:0; border:0; outline:0;
        color:var(--tg-theme-text-color,#111); background:transparent;
        font:inherit; font-size:16px; text-align:left;
    }
    .gs-results { min-height:72px; margin-top:9px; }
    .gs-section { margin-bottom:10px; }
    .gs-section-title {
        margin:7px 8px 4px; color:var(--tg-theme-hint-color,#68717d);
        font-size:10px; font-weight:800; letter-spacing:.07em; text-transform:uppercase;
    }
    .gs-row {
        display:block; width:100%; min-height:42px; padding:9px 10px;
        border:0; border-bottom:1px solid var(--app-border); border-radius:8px;
        color:var(--tg-theme-text-color,#111); background:transparent;
        font:inherit; text-align:left; cursor:pointer;
    }
    .gs-row:hover, .gs-row:focus-visible { outline:0; background:var(--app-accent-soft); }
    .gs-state {
        display:flex; align-items:center; justify-content:center; min-height:88px; padding:12px;
        border:1px dashed var(--app-border-strong); border-radius:12px;
        color:var(--tg-theme-hint-color,#68717d); text-align:center; line-height:1.4;
    }
    .gs-state.is-error { color:var(--neg,#d11); }
    .doc-sec { overflow:hidden; }
    .doc-h { width:100%; text-align:left; font:inherit; border:none; cursor:pointer; color:inherit; }
    .doc-b code { background: var(--tg-theme-secondary-bg-color,#eee); padding:1px 4px; border-radius:4px; }
 /* freeze the first column (№ / name) while scrolling horizontally */
 /* Scoped to the top-level ledger grid only: nested tables (e.g. Summary mini tables)
 must remain normal-flow, otherwise their first column collapses/sticks incorrectly. */
 #grid > tbody > tr > td:first-child,
 #grid > thead > tr > th:first-child {
        position: sticky; left: 0; z-index: 1;
        background: var(--tg-theme-bg-color,#fff);
    }
 #grid > thead > tr > th:first-child {
        z-index: 3; background: var(--tg-theme-secondary-bg-color,#f2f2f2);
    }

/* Dark theme overrides → app_dark.css. */
