/* FB Stats — styles of the screens of track B: overview, accounts list, attention, events, Business
 * Managers, pages, pixels. Loaded after styles.css (shared tokens and components). */

.inventory { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text-secondary); font-size: var(--fs-md); }
.inv-item { display: inline-flex; align-items: baseline; gap: 5px; color: var(--text-secondary); }
@media (hover: hover) { .inv-item:hover { color: var(--link); text-decoration: none; } }
.inv-sep { color: var(--text-muted); }
.inv-item strong { color: var(--text); }
.inv-problem { color: var(--bad-ink); font-size: 12px; font-weight: 600; }
.event-day { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.event-day-title { margin-bottom: 10px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.table tr.health-bad > td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table tr.health-warn > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

.table-accounts .col-account { position: sticky; left: 0; z-index: 1; min-width: 250px; max-width: 330px; background: var(--surface); }
.table-accounts th.col-account, .table-accounts tfoot td.col-account { z-index: 3; background: var(--surface-2); }
@media (hover: hover) { .table-accounts tbody tr:hover > td.col-account { background: color-mix(in srgb, var(--text) 5%, var(--surface)); } }
.ad-counts { display: inline-flex; align-items: baseline; gap: 3px; font-variant-numeric: tabular-nums; }
.ad-count { font-weight: 600; color: var(--tone-ink); }
.ad-count.is-zero { color: var(--text-muted); font-weight: 400; }
.ad-counts-sep { color: var(--text-muted); }
.health { display: inline-flex; align-items: center; gap: 7px; max-width: 210px; }
.health-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-secondary); }
.share { display: inline-flex; align-items: center; gap: 8px; }
.share-bar { display: inline-block; width: 56px; height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.share-fill { display: block; height: 100%; background: var(--series-1); }
@media (hover: hover) { a.ad-count:hover { text-decoration: underline; } }
.acct-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); font-size: 13px;
}
.acct-strip[hidden] { display: none; }
.acct-strip strong { color: var(--text); }
.acct-strip .btn { margin-left: auto; }
.table-accounts .col-state { max-width: 250px; }
/* «Состояние»: the default columns fit a 1280 px window without scrolling sideways. */
.table-accounts-state th, .table-accounts-state td { padding-left: 8px; padding-right: 8px; }
.table-accounts-state .col-account { min-width: 210px; max-width: 290px; }
.table-accounts-state .col-state { min-width: 190px; }
.table-accounts.table-accounts-state .col-pay { min-width: 118px; }
.table-accounts-state tfoot td.col-account { white-space: normal; }
.table-accounts .col-pay { min-width: 132px; max-width: 210px; overflow-wrap: anywhere; }
.table-accounts .col-access { min-width: 120px; max-width: 190px; }
.table-accounts .col-checks { min-width: 170px; max-width: 260px; font-size: 12px; }
.table-accounts .col-bm { min-width: 130px; max-width: 200px; overflow-wrap: anywhere; }
.detail-reason { margin: 0; max-width: 640px; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.detail-reason.tone-warn { margin-top: 6px; color: var(--warn-ink); }
.role-line + .role-line { margin-top: 6px; }
.empty-reasons { margin-top: 8px; color: var(--warn-ink); font-size: 13px; }
.badge-row { margin-top: 4px; }
.table-pages .cell-sub { max-width: 280px; }
.table-pages .col-page { min-width: 240px; }
.table-pages .col-rights { min-width: 220px; }
.table-pages .col-promo { min-width: 190px; }
.fold-toggle {
  align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit;
  font-weight: 500; color: var(--text); text-align: left; cursor: pointer;
}
.event.is-unseen .fold-toggle { font-weight: 700; }
@media (hover: hover) { .fold-toggle:hover { text-decoration: underline; } }
.fold-toggle .icon { flex: none; width: 16px; height: 16px; color: var(--text-muted); }
.event-sublist { margin-top: 8px; padding: 8px 0 0 12px; border-top: 1px solid var(--border); border-left: 2px solid var(--border); }

/* «Требует внимания»: the first block of the overview. */
.attention.is-clear {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.attention-top { flex-wrap: wrap; gap: 8px 12px; }
.attention-top .card-title { margin-right: 0; }
.attention-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.attention-ok { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
/* Columns, not a grid: a short group does not leave a hole next to a long one. */
.attention-groups { columns: 380px; column-gap: 10px; }
.attention-group {
  break-inside: avoid; margin-bottom: 10px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--tone);
  border-radius: 8px; background: var(--surface-raised);
}
.attention-groups > .attention-group:last-child { margin-bottom: 0; }
.attention-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-bottom: 6px; }
.attention-type { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.attention-name { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.attention-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention-item { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.attention-body { flex: 1; min-width: 0; }
.attention-text { font-weight: 500; overflow-wrap: anywhere; }
.attention-hint { margin-top: 1px; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.attention-link { display: inline-flex; align-items: center; gap: 2px; margin-top: 3px; font-size: 12px; font-weight: 600; }
.attention-link .icon { width: 12px; height: 12px; }
.attention-more { margin-top: 10px; }
/* A row of ad counters may now hold six of them («не показываются» was added): in the accounts
 * table they wrap onto a second line instead of making the table wider than its frame. */
.table-accounts .ad-counts { flex-wrap: wrap; justify-content: flex-end; max-width: 108px; }

/* ------------------------------------------------ pixels (web/pixels.js) */

/* The default columns fit a 1280 px window: names wrap, ids and counts do not. */
.table-pixels .tree-name { min-width: 190px; }
.table-pixels .col-state { min-width: 168px; }
.table-pixels .col-owner { max-width: 170px; overflow-wrap: anywhere; }
.table-pixels .col-accounts { max-width: 220px; overflow-wrap: anywhere; }
.table-pixels td .chips { max-width: 190px; }
.pixel-scope[hidden] { display: none; }
.pixel-closed .plain-list { margin-top: 4px; }
.pixel-closed details { margin-top: 2px; }
.pixel-closed summary { cursor: pointer; color: var(--text-secondary); }
.empty-line { margin: 0; }
.empty-line + .empty-line { margin-top: 8px; }
.empty-reasons .plain-list li { overflow-wrap: anywhere; }
.pixel-detail .note-banner { margin-bottom: 10px; }
.pixel-detail .detail-reason + .btn, .pixel-detail .table-wrap + .btn, .pixel-detail .table-wrap + .cell-sub { margin-top: 8px; }
.pixel-detail .hbar-row { grid-template-columns: minmax(90px, 230px) minmax(0, 1fr); }
.pixel-events .chart + .cell-sub { margin-top: 8px; }
.table-pixel-adsets td { overflow-wrap: anywhere; }
.pixel-inline .badge { vertical-align: baseline; }
/* The Business Managers table got a «Пиксели» column and still fits a 1280 px window: the column
 * is as narrow as its header (details are hints), the name column gives up a few pixels. */
.table-bm .tree-name { min-width: 180px; }
.table-bm td.col-pixels { white-space: normal; }

/* ------------------------------------------------ round 4 (track B) */

/* Обзор: two tile groups (D5, V-09), one-line labels, the status bar inside «Активные аккаунты». */
.overview .kpi-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.overview .kpi-group-title { margin: 0; }
.overview .kpi-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview .kpi-value a { color: inherit; }
@media (hover: hover) { .overview .kpi-value a:hover { color: var(--link); text-decoration: none; } }
.kpi-stack { display: flex; gap: 2px; height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; }
.kpi-stack-part { flex-basis: 0; min-width: 3px; }
/* V-02: names in the top tables neither push the numbers out nor wrap one word per line. */
.table-top .col-name { min-width: 160px; max-width: 280px; overflow-wrap: anywhere; }
.actions-more { margin-top: 10px; }
.unconverted-text { min-width: 0; }

/* The overview preview of «Требует внимания»: chips and «Показать все» open #/attention. */
@media (hover: hover) { a.attention-chip:hover { text-decoration: none; filter: brightness(0.96); } }
.attention-line { display: none; }
/* Desktop shows the advice lines in the preview too (review RD-3); the phone keeps one line
 * per group (plan 1.3), see the phone block. */
.attention-preview .attention-items { gap: 4px; }
.attention-more .icon { width: 14px; height: 14px; }

/* «Внимание › Требует действий» (#/attention). */
.attention-list { display: grid; gap: 10px; }
.attention-card {
  padding: 10px 12px 2px; border: 1px solid var(--border); border-left: 3px solid var(--tone);
  border-radius: var(--radius); background: var(--surface);
}
.attention-rows { list-style: none; margin: 0; padding: 0; }
.attention-row {
  display: flex; align-items: flex-start; gap: 8px; min-height: var(--tap); margin: 0 -12px; padding: 8px 12px;
  border-top: 1px solid var(--border); color: var(--text);
}
.attention-rows > li:first-child > .attention-row { border-top: 0; }
@media (hover: hover) { a.attention-row:hover { background: var(--hover); text-decoration: none; } }
.attention-row .attention-body { display: flex; flex-direction: column; }
.attention-row .attention-link { margin-top: 2px; color: var(--link); }
.attention-row > .icon:last-child { flex: none; align-self: center; margin-left: auto; width: 16px; height: 16px; color: var(--text-muted); }
.attention-ok-line { color: var(--text-secondary); font-size: var(--fs-md); }
.attention-ok-line[hidden], .toolbar-chips[hidden] { display: none; }
.attention-ok-line .icon { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; color: var(--ok); }

/* «Внимание › События»: the whole row is the link; a folded row is one full-width toggle. */
.view-events .event { position: relative; }
.view-events .event > .event-body > a.event-title::after { content: ""; position: absolute; inset: 0; }
.view-events .event > .event-body > a.event-title:focus-visible { outline: none; }
.view-events .event:has(> .event-body > a.event-title:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.fold-toggle { display: flex; width: 100%; }
.events-groups { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }

/* Рекламные аккаунты (V-12): the status cell is wide enough for two lines, each clamped to two. */
.table-accounts .col-state { min-width: 180px; }
.table-accounts td.col-state .cell-sub {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.table-accounts .col-mnote { display: none; }
.acc-owner { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.no-rate { color: var(--warn-ink); font-size: var(--fs-sm); }
.active-filters, .acct-strip-more { display: none; }
/* «Платежи CSV» of the filter sheet; on the page itself the strip carries its own button. */
.view-accounts .accounts-filters > .acct-payments { display: none; }
.active-chip .icon { width: 12px; height: 12px; }

/* Filters moved into a bottom sheet on a phone (Present.filterSheet). */
.filter-sheet { display: grid; gap: 14px; }
.filter-sheet .fchips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter-sheet .fchip { justify-content: space-between; min-height: var(--tap); }
.filter-sheet .select { width: 100%; max-width: none; min-height: var(--tap); }
.filter-sheet .check { min-height: var(--tap); }
.filter-sheet > .btn, .filter-sheet > a.btn { justify-content: center; min-height: var(--tap); }
.filter-sheet details.menu[open] > .menu-pop {
  position: static; max-height: none; margin-top: 6px; padding: 0; border: 0; box-shadow: none; background: none;
}
.filter-sheet .events-groups { display: grid; gap: 8px; }

/* Активы: the card of a BM / pixel in its sheet (phone). */
.sheet-detail .detail { display: grid; gap: 12px; }
.table td.col-email { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  /* Обзор */
  .overview .kpi-groups .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .overview .kpi-groups .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .overview .kpi { padding: 12px; }
  .unconverted-note { align-items: center; }
  /* Two lines at most, so the currencies it names stay readable (review F-12). */
  .unconverted-text { flex: 1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .inventory .inv-item { min-height: var(--tap); align-items: center; }
  .attention-preview .attention-groups { columns: auto; }
  .attention-preview .attention-group { margin-bottom: 6px; padding: 0; }
  .attention-preview .attention-head, .attention-preview .attention-items, .attention-preview .attention-hint { display: none; }
  .attention-preview .attention-line {
    display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 6px 10px; color: var(--text);
  }
  .attention-line-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .attention-line-name { font-weight: 600; }
  .attention-line-more { flex: none; color: var(--text-secondary); font-size: var(--fs-sm); font-weight: 600; }
  .attention-line > .icon:last-child { flex: none; width: 16px; height: 16px; color: var(--text-muted); }
  .attention-more { display: flex; justify-content: center; width: 100%; min-height: var(--tap); }
  .attention-preview .attention-top { gap: 8px; }
  .attention-preview .attention-top .card-title { flex: 1 1 100%; }
  .attention-preview .attention-chips { flex: 1 1 100%; gap: 8px; }
  .attention-chips .attention-chip { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-pill); }
  .attention-preview .attention-ok { display: inline-flex; align-items: center; min-height: var(--tap); white-space: normal; }
  .attention-preview .card-title a { display: inline-flex; align-items: center; min-height: var(--tap); }

  .attention-card .attention-name { display: inline-flex; align-items: center; min-height: var(--tap); }
  .attention-card .attention-head { margin-bottom: 0; }
  .attention-ok-line a { display: inline-flex; align-items: center; min-height: var(--tap); }

  /* The search sheet (Present.openSearch): name on line 1, id and where it lives on line 2. */
  .gsearch.is-sheet .gsearch-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px; }
  .gsearch.is-sheet .gsearch-name { flex: 1 1 100%; }
  .gsearch.is-sheet .gsearch-sub { flex: 1 1 0; min-width: 0; }
  .gsearch.is-sheet .gsearch-more { display: flex; align-items: center; min-height: var(--tap); }

  /* Внимание: the chip rows scroll sideways instead of wrapping into a wall. */
  .attention-filters .fchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .attention-filters .fchips::-webkit-scrollbar { display: none; }
  .attention-filters .fchip { flex: none; }
  .attention-filters .toolbar-chips { min-width: 0; max-width: 100%; }
  .view-events .event-day { padding: 12px; }
  .view-events .event { min-height: var(--tap); }
  .fold-toggle { min-height: var(--tap); align-items: center; }

  /* Рекламные аккаунты */
  .view-accounts .accounts-toolbar > .search { flex: 1 1 180px; }
  .view-accounts .accounts-toolbar > .search .input { width: 100%; }
  .view-accounts .accounts-toolbar > .seg { flex: 1 1 auto; }
  .view-accounts .accounts-toolbar > .seg .seg-btn { flex: 1; }
  .table-accounts.is-cards td.m-badge .status-lines { display: none; }
  .table-accounts.is-cards td.col-spark { order: 1; }
  .table-accounts.is-cards tfoot td.col-mnote, .table-accounts.is-cards td.col-mnote:empty { display: none; }
  .table-accounts.is-cards .ad-counts { max-width: none; justify-content: flex-start; }


  /* Small shared controls inside the cards of these screens get a 44 px target on touch. */
  .overview .card-link, .unconverted-note a { display: inline-flex; align-items: center; min-height: var(--tap); }
  :is(.table-accounts, .table-bm, .table-pages, .table-pixels, .table-top).is-cards :is(.copy-id, a.ext-link, .hint, .no-rate, .hint-wrap),
  .sheet-detail :is(.copy-id, a.ext-link, .hint) {
    display: inline-flex; align-items: center; min-height: var(--tap); min-width: var(--tap);
  }
  /* A profile chip keeps its small pill look; a transparent border makes its target 44 px
   * (review F-10, the same trick as the account page). */
  :is(.table-accounts, .table-bm, .table-pages, .table-pixels, .table-top).is-cards a.chip, .sheet-detail a.chip {
    border: 13px solid transparent; border-left-width: 0; border-right-width: 0; margin: -13px 0;
    border-radius: 23px; background-clip: padding-box;
  }
  :is(.table-accounts, .table-bm, .table-pages, .table-pixels, .table-top).is-cards .chips:has(> a.chip),
  .sheet-detail .chips:has(> a.chip) { row-gap: 0; }
  :is(.table-accounts, .table-bm, .table-pages, .table-pixels).is-cards .acc-meta { align-items: center; row-gap: 0; }

  /* Активы */
  .table-bm.is-cards .tree-name, .table-pixels.is-cards .tree-name { min-width: 0; }
  .table-bm.is-cards .tree-toggle, .table-pixels.is-cards .tree-toggle { display: none; }
  .table-pages.is-cards .col-page, .table-pages.is-cards .col-rights, .table-pages.is-cards .col-promo { min-width: 0; }
  .table-pages.is-cards .cell-sub, .table-pixels.is-cards td .chips { max-width: none; }
  .table-pixels.is-cards .col-owner, .table-pixels.is-cards .col-accounts { max-width: none; }
  .pixel-detail .hbar-row { grid-template-columns: minmax(0, 1fr); }
}

@media (hover: hover) and (max-width: 640px) { .attention-preview a.attention-line:hover { text-decoration: none; } }

/* ------------------------------------------------ round 5 (track V) */

/* Обзор (plan5 V1): the tile blocks, the phone toggles of the top tables and of «Действия». */
.overview .kpi-groups-money .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.top-more, .actions-fold { display: none; }
.actions-fold .icon, .top-more .icon { width: 16px; height: 16px; }
/* Аккаунты (V2): the sort chip and the one-line total exist for the phone only. */
.acct-sort-chip, .acct-sum { display: none; }
.acct-sort { display: none; }
.filter-sheet .acct-sort { display: grid; gap: 6px; color: var(--text-secondary); font-size: var(--fs-md); }
.acct-sort-arrow { font-weight: 700; }
.acct-sum {
  align-items: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text-secondary); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer;
}
.acct-sum-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-sum-text strong { color: var(--text); }
.acct-sum > .icon { flex: none; width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.15s; }
.acct-sum.is-open > .icon { transform: rotate(180deg); }
.acct-sum.is-open .acct-sum-text { white-space: normal; }
/* Внимание (V4): «Область» lives in a sheet on a phone and a touch tablet only. */
.view-attention .attention-area-btn { display: none; }

@media (max-width: 640px) {
  /* Обзор: 3 groups of «Требует внимания» (5 on wider screens), the top tables as one-line rows. */
  .attention-preview .attention-groups > .attention-group:nth-child(n+4) { display: none; }
  .overview .table-top.is-cards > tbody { gap: 0; }
  .overview .table-top.is-cards tr {
    grid-template-columns: minmax(0, 1fr) 6.6em 5.6em; align-items: center; gap: 2px 10px; padding: 8px 0;
    border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; min-height: var(--tap);
  }
  .overview .table-top.is-cards tbody tr:first-child { border-top: 0; }
  .overview .table-top.is-cards td.m-title { grid-column: 1; grid-row: 1; min-width: 0; }
  .overview .table-top.is-cards td.m-title > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .overview .table-top.is-cards td.m-title .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .overview .table-top.is-cards td.m-metric { grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .overview .table-top.is-cards td.m-metric::before, .overview .table-top.is-cards td.m-more { display: none; }
  .overview .table-top.is-cards td.m-metric { min-width: 0; }
  .overview .table-top.is-cards td.m-metric .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
  .overview .table-top .col-name { min-width: 0; max-width: none; }
  .overview .top-card:not(.is-all) .table-top.is-cards > tbody > tr:nth-child(n+6) { display: none; }
  .overview .top-card .top-more { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; margin-top: 8px; min-height: var(--tap); }
  .overview .actions-card .card-head { align-items: center; }
  /* The head's actions box holds only the hint: hidden, so the fold button stays on the title row. */
  .overview .actions-card .card-head > .card-actions { display: none; }
  .overview .actions-card.is-folded > .card-body { display: none; }
  /* Folded: the head is the whole card, padded alike above and below (round-5 review L4). */
  .overview .actions-card.is-folded > .card-head { padding-bottom: 12px; }
  /* The inventory wraps on a phone: no «·» left dangling at a line end, the gap separates. */
  .overview .inventory { column-gap: 18px; }
  .overview .inventory .inv-sep { display: none; }
  .overview .actions-fold {
    display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin: -8px -10px -8px auto;
    padding: 0; border: 0; background: none; color: var(--text-muted); cursor: pointer;
  }
  .overview .actions-fold[aria-expanded="true"] .icon { transform: rotate(180deg); }

  /* Аккаунты: search + sort chip on one row, the view switch + «Фильтры» on the next; one line of
   * totals; cards of two lines (name + status, today · period · result), the ID, the owner and the
   * profiles under «Подробнее». */
  .view-accounts { gap: 10px; }
  .view-accounts .accounts-toolbar { row-gap: 8px; }
  .view-accounts .acct-sort-chip { display: inline-flex; flex: none; gap: 4px; padding: 0 12px; }
  .view-accounts .acct-sum { display: flex; }
  .view-accounts .acct-strip { display: none; }
  .view-accounts .acct-sum.is-open + .acct-strip:not([hidden]) { display: flex; flex-wrap: wrap; cursor: default; }
  .view-accounts .acct-sum.is-open + .acct-strip > span { display: inline; }
  .view-accounts .acct-sum.is-open + .acct-strip .acct-strip-lead { flex-basis: 100%; white-space: normal; }
  .view-accounts .acct-sum.is-open + .acct-strip .acct-strip-csv { display: inline-flex; }
  .view-accounts .acct-sum.is-open + .acct-strip .acct-strip-more { display: none; }
  .table-accounts.is-cards > tfoot { display: none; }
  .table-accounts.is-cards tr { gap: 4px 12px; padding: 10px 12px; }
  .table-accounts.is-cards tr:not(.is-more) td.m-title :is(.acc-meta, .chips) { display: none; }
  .table-accounts.is-cards td.m-title .acc-name { font-weight: 600; }
  .table-accounts.is-cards td.m-more { margin: -4px 0 -10px; }
  .table-accounts.is-cards td.col-mnote .cell-sub, .table-accounts.is-cards td.col-mnote { font-size: var(--fs-sm); }
  /* «239 покупки» on one line: what the number counts follows it, cut when long. */
  .table-accounts.is-cards td.m-metric { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-accounts.is-cards td.m-metric > .cell-sub { display: inline; margin-left: 4px; font-size: var(--fs-sm); white-space: nowrap; }
  /* A value on its own line («401,84 $ / 100,00 $» of «Не оплачено» in «Состояние») wraps instead of being cut
   * without an ellipsis (round 5 integration). */
  .table-accounts.is-cards td.m-metric > div:not(.cell-sub):not(.meter) { white-space: normal; overflow-wrap: anywhere; }
}

/* Phone, and a phone held sideways (844×390: the tablet tier with little height), and a touch
 * tablet held upright (round 5, V6): the filters of the lists live in the «Фильтры» sheet and chip
 * rows scroll sideways, so the list starts on the first screen. Keep in step with COMPACT_QUERY in
 * web/present.js (a test compares them). */
@media (max-width: 640px), (max-width: 1023px) and (max-height: 500px), (max-width: 1023px) and (hover: none) and (pointer: coarse) {
  .view-attention .attention-area-btn { display: inline-flex; flex: none; }
  .view-attention .attention-area-row { display: none; }
  .view-attention .attention-filters { flex-wrap: nowrap; }
  .view-accounts .toolbar-sheet-btn, .view-events .toolbar-sheet-btn { display: inline-flex; }
  .view-events .events-filters, .view-events .events-groups { display: none; }
  .view-accounts .accounts-filters { display: none; }
  .view-accounts .accounts-toolbar > .check, .view-accounts .accounts-toolbar > details.menu,
  .view-accounts .accounts-toolbar > a.btn, .view-accounts .accounts-toolbar > .toolbar-spacer { display: none; }
  .active-filters { display: flex; flex-wrap: wrap; gap: 8px; }
  .active-filters[hidden] { display: none; }
  .acct-strip { flex-wrap: nowrap; gap: 8px; min-height: var(--tap); cursor: pointer; }
  .acct-strip:not(.is-open) > span:not(.acct-strip-lead):not(.acct-strip-more), .acct-strip .acct-strip-csv { display: none; }
  .acct-strip-lead { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .acct-strip.is-open { flex-wrap: wrap; }
  .acct-strip.is-open .acct-strip-lead { flex-basis: 100%; white-space: normal; }
  .acct-strip-more { display: inline-flex; flex: none; margin-left: auto; color: var(--text-muted); }
  .acct-strip.is-open .acct-strip-more { transform: rotate(180deg); }
  /* Lists (Активы, Внимание): chip rows scroll sideways instead of filling the first screen. */
  .view-body > .toolbar .toolbar-chips { flex: 1 1 200px; min-width: 0; max-width: 100%; }
  .note-banner.pixel-closed { align-items: center; padding-top: 4px; padding-bottom: 4px; }
  .view-body > .toolbar .toolbar-chips .fchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .view-body > .toolbar .toolbar-chips .fchips::-webkit-scrollbar { display: none; }
  .view-body > .toolbar .toolbar-chips .fchip { flex: none; }
  .pixel-closed-fold > summary { display: flex; align-items: center; min-height: var(--tap); cursor: pointer; }
  .pixel-closed-fold { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .acct-sum > .icon, .overview .actions-fold .icon { transition: none; }
}
