/* 16-phone.css — the phone page's components (task 113), out of task 109's /MySets: `.ui-m-<block>`, BEM elements,
   states as ARIA attributes. Linked by _Layout after 13-accounts.css on a page that renders its phone markup
   (ViewData["PhonePage"], which also gives the body `app-shell--mobile`) and by /Design; a desktop page carries none of
   it. A page's own phone stylesheet comes after it (@section Styles). Semantic tokens only, like 01-components.css
   (DesignSystemTests), `tabular-nums` in every figure. Every class is on /Design → «Телефон». The rule for a new
   phone page: wwwroot/css/site/CLAUDE.md. */

.app-shell--mobile {
  --m-gutter: 12px;
  /* The phone's header (01-base.css, ≤ 900 px): 52 px under the safe area. The bar (.ui-m-bar) sticks under it. */
  --m-header: calc(52px + env(safe-area-inset-top, 0px));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ui-m-page {
  /* Room under the last row for the «+» button. */
  padding-bottom: 72px;
  font-variant-numeric: tabular-nums;
}

.ui-m-page p,
.ui-m-page dl,
.ui-m-page ul {
  margin: 0;
}

/* ── Title, «⋯» on the right, «‹» back on the left (optional) ── */
.ui-m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -6px -10px 2px 0;
}

.ui-m-head__title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ui-m-head__back {
  margin-left: -10px;
}

.ui-m-head__title:not(:first-child) {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-head__back svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-m-head__more svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

/* ── The summary: one large figure, a pair under it, a small line ── */
/* Its own figures line up outside .ui-m-page too, as on /Design (task 121: eight pages wrote the block and it had no rule). */
.ui-m-summary {
  font-variant-numeric: tabular-nums;
}

.ui-m-summary__label {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.ui-m-summary__value {
  margin-top: 2px;
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.ui-m-summary__value span {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: 0;
}

.ui-m-summary__value--empty span {
  font-weight: 500;
}

.ui-m-summary__pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3) !important;
}

.ui-m-summary__pair dt {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.ui-m-summary__pair dd {
  margin: 1px 0 0;
  font-size: var(--text-md);
  font-weight: 600;
  white-space: nowrap;
}

.ui-m-summary__pair dd span {
  font-weight: 500;
}

.ui-m-summary__sub {
  margin-top: var(--space-2) !important;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* ── The value chart (portfolio-chart.js; /MySets' since task 109, «Мої мініфігурки»' since task 189) ──
   The window's change over the canvas, the canvas 180 px, and the tip box the script draws there instead of Chart.js's
   tooltip ([data-chart-tip]) — a dot per line in that line's token, the PnL foot in --up / --down. */
.ui-m-chart .pnl--up { color: var(--up); }
.ui-m-chart .pnl--down { color: var(--down); }

.ui-m-chart__change {
  min-height: 18px;
  margin: 0 0 var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.ui-m-chart__canvas {
  position: relative;
  height: 180px;
  /* The chart answers the finger sideways; up and down still scroll the page. */
  touch-action: pan-y;
}

.ui-m-chart__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-2);
  background: color-mix(in srgb, var(--surface-2) 94%, transparent);
  box-shadow: var(--shadow-2);
  font-size: var(--text-xs);
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.ui-m-chart__tip[hidden] {
  display: none;
}

.ui-m-chart__tip-date {
  margin-bottom: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.ui-m-chart__tip-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ui-m-chart__tip-line b {
  margin-left: auto;
  padding-left: var(--space-3);
  font-weight: 600;
}

.ui-m-chart__tip-foot {
  margin-top: 2px;
  font-weight: 700;
}

/* The legend: one dot per line, in the line's colour (portfolio-chart.js draws them in the same tokens). */
.ui-m-chart__dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.ui-m-chart__dot--actual { background: var(--chart-1); }
.ui-m-chart__dot--ask { background: var(--chart-2); }
.ui-m-chart__dot--invested { background: var(--chart-3); }

/* ── Range switch (7Д … Все) ─────────────────────────── */
.ui-m-ranges {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

/* 44 px tall for the finger; the visible pill is the button's middle 30 px. */
.ui-m-range {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  height: var(--touch);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--duration-1) var(--ease);
}

.ui-m-range::before {
  content: "";
  position: absolute;
  inset: 7px 2px;
  z-index: -1;
  border-radius: var(--radius-pill);
  background: transparent;
  transition: background-color var(--duration-1) var(--ease), transform var(--duration-1) var(--ease);
}

.ui-m-range[aria-pressed="true"] {
  color: var(--text);
}

.ui-m-range[aria-pressed="true"]::before {
  background: var(--surface-3);
}

.ui-m-range:active::before {
  transform: scale(0.94);
}

.ui-m-range:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -4px;
  border-radius: var(--radius-pill);
}

/* A part of the page under the summary: the chart, the strip, the list. An anchor on it lands under the sticky header. */
.ui-m-section {
  margin-top: var(--space-4);
  scroll-margin-top: var(--m-header);
}

/* ── A strip of tiles: two and a half on the screen, swiped sideways (a .ui-chiprow) ── */
.ui-m-strip {
  max-width: none;
  margin: 0 calc(-1 * var(--m-gutter));
  padding: 2px var(--m-gutter) 4px;
  scroll-padding-inline: var(--m-gutter);
}

.ui-m-tile {
  display: grid;
  align-content: start;
  gap: 2px;
  width: var(--m-tile-width, calc((100vw - 2 * var(--m-gutter) - 2 * var(--space-2)) / 2.5));
  min-height: 72px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-3);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--duration-1) var(--ease), background-color var(--duration-1) var(--ease);
}

.ui-m-tile:active {
  transform: scale(0.97);
}

.ui-m-tile:disabled {
  cursor: default;
  transform: none;
}

.ui-m-tile:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ui-m-tile__label {
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-tile__title {
  font-size: var(--text-sm);
  font-weight: 600;
}

.ui-m-tile__value {
  font-size: var(--text-md);
  font-weight: 700;
}

.ui-m-alerts {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3) !important;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.ui-m-alerts__item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-2);
  background: var(--info-bg);
  color: var(--info);
}

.ui-m-alerts__item--warning { background: var(--warn-bg); color: var(--warn); }
.ui-m-alerts__item--danger { background: var(--down-bg); color: var(--down); }

/* An item that is a link (task 116: «4 без цілі» opens that filter) reads as the item, the whole box the target. */
.ui-m-alerts__item a {
  display: block;
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3));
  padding: var(--space-2) var(--space-3);
  color: inherit;
  text-decoration: none;
}

/* ── The bar: tab chips, search, sort / filters ────────── */
/* Held under the header while the list scrolls; translucent, the rows pass under it. */
.ui-m-bar {
  position: sticky;
  top: var(--m-header);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 calc(-1 * var(--m-gutter));
  padding: 0 var(--space-1) 0 var(--m-gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow: 0 1px 0 var(--border);
  backdrop-filter: saturate(1.4) blur(14px);
}

.ui-m-tabs {
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  margin-left: calc(-1 * var(--m-gutter));
  padding-left: var(--m-gutter);
  scroll-padding-inline: var(--m-gutter);
  /* The strip scrolls: its right edge fades rather than cutting a word in half. */
  mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
}

/* 44 px tall for the finger, a 30 px pill drawn inside it. */
.ui-m-tab {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--touch);
  padding: 0 11px;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-m-tab::before {
  content: "";
  position: absolute;
  inset: 7px 0;
  z-index: -1;
  border-radius: var(--radius-pill);
  background: transparent;
  transition: background-color var(--duration-1) var(--ease);
}

.ui-m-tab span {
  color: var(--text-faint);
  font-weight: 500;
}

.ui-m-tab:hover {
  color: var(--text);
}

.ui-m-tab[aria-current="page"] {
  color: var(--text);
}

.ui-m-tab[aria-current="page"]::before {
  background: var(--surface-3);
}

.ui-m-tab[aria-current="page"] span {
  color: var(--text-muted);
}

.ui-m-tab[aria-disabled="true"] {
  opacity: 0.5;
}

.ui-m-tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -4px;
  border-radius: var(--radius-pill);
}

/* The search: a magnifier; open, a field that takes the tabs' place (the magnifier becomes its ×). */
.ui-m-search {
  flex: none;
  position: relative;
}

.ui-m-search > summary {
  list-style: none;
}

.ui-m-search > summary::-webkit-details-marker {
  display: none;
}

.ui-m-search[open] {
  flex: 1 1 auto;
}

.ui-m-bar:has(.ui-m-search[open]) .ui-m-tabs,
.ui-m-bar:has(.ui-m-search[open]) > .ui-m-filters {
  display: none;
}

/* Filter pills in the tabs' place (task 117, /Analytics: «Фільтри», the sort): they scroll on their own, from the edge. */
.ui-m-bar > .ui-m-filters {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 0 0 calc(-1 * var(--m-gutter));
}

.ui-m-search[open] > summary {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  background: none;
}

.ui-m-search[open] > summary svg {
  display: none;
}

.ui-m-search[open] > summary::after {
  content: "×";
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
}

.ui-m-search__form {
  padding: 4px 0;
}

/* The search last in the bar (no sort beside it, the catalogue): the open field stops at the gutter, not the edge. */
.ui-m-search[open]:last-child {
  margin-right: calc(var(--m-gutter) - var(--space-1));
}

.ui-m-search__form .ui-input {
  height: 36px;
  padding-right: 44px;
  border-radius: var(--radius-pill);
}

.ui-m-search__form .ui-input::-webkit-search-cancel-button {
  display: none;
}

.ui-m-bar > .ui-btn--icon {
  flex: none;
}

.ui-m-bar .ui-btn--icon svg {
  width: 18px;
  height: 18px;
}

/* ── The list: 64 px rows (≤ 76), a 48 px picture on --photo-bg, a title, a sub-line with ONE chip, a figure and its
   change on the right; a tap opens the row's sheet (phone.js) or, without script, follows the link ── */
.ui-m-list {
  padding: 0;
  list-style: none;
}

.ui-m-row {
  position: relative;
}

.ui-m-row[hidden] {
  display: none;
}

/* The hairline between rows starts at the name, not under the picture. */
.ui-m-row + .ui-m-row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 60px;
  height: 1px;
  background: var(--border);
}

.ui-m-row__link {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  margin: 0 calc(-1 * var(--m-gutter));
  padding: var(--space-2) var(--m-gutter);
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--duration-2) var(--ease);
}

.ui-m-row__link:hover {
  color: var(--text);
}

/* Feedback on the press itself, before the sheet: the row lights up under the finger. */
.ui-m-row__link:active {
  background: var(--surface-1);
  transition-duration: 0ms;
}

.ui-m-row__link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.ui-m-row__img,
.ui-m-sheet__img {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-2);
  background: var(--photo-bg);
}

.ui-m-row__img {
  width: 48px;
  height: 48px;
}

.ui-m-row__img img,
.ui-m-sheet__img img {
  display: block;
  width: 100%;
  height: 100%;
  padding: var(--photo-inset);
  object-fit: contain;
  outline: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  outline-offset: -1px;
  border-radius: inherit;
}

.ui-m-row__main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ui-m-row__title {
  overflow: hidden;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-row__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ui-m-row__num {
  flex: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.ui-m-row__meta .tag,
.ui-m-row__meta .ui-chip {
  overflow: hidden;
  min-height: 18px;
  padding: 0 6px;
  font-size: 0.6875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-row__meta .ui-chip {
  flex: none;
}

/* A short sentence after the chip (task 119: a provider's last problem), cut to the line. */
.ui-m-row__note {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-row__fig {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
  white-space: nowrap;
}

.ui-m-row__value {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
}

.ui-m-row__change {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.ui-m-empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-4);
  color: var(--text-muted);
  text-align: center;
}

.ui-m-empty[hidden] {
  display: none;
}

/* ── «+»: the page's main action, floating above the tab bar — a link, or a button that opens a sheet (task 119) ── */
.ui-m-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-space) + 16px);
  z-index: 30;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-2);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--duration-2) var(--ease-out), opacity var(--duration-2) var(--ease-out), background-color var(--duration-1) var(--ease);
}

/* Under a page with «+», the app's footer (task 132) ends 80 px lower than its last line: at the page's end the button
   (56 px, 16 px over the bar) covers that space, not a link. */
body:has(.ui-m-fab) .app-footer .ui-footer__inner {
  padding-bottom: 80px;
}

/* Scrolling down it steps aside (phone.js), so it does not sit on the rows' figures; up brings it back. */
.ui-m-fab.is-away {
  opacity: 0;
  transform: translateY(24px) scale(0.9);
  pointer-events: none;
}

.ui-m-fab:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.ui-m-fab:active {
  transform: scale(0.94);
}

.ui-m-fab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.ui-m-fab svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
}

/* ── Bottom sheet, «details»: a row's everything, filled from its <template> (phone.js) ── */
.ui-m-sheet {
  max-height: calc(100dvh - 24px);
  background: var(--surface-1);
  outline: none;
}

/* Dragged by the finger (phone.js): no transition while it follows, no text selection. */
.ui-m-sheet.is-dragging {
  user-select: none;
}

.ui-m-sheet__grip {
  display: grid;
  place-items: center;
  height: 22px;
}

.ui-m-sheet__grip .ui-sheet__grip {
  margin: 0;
}

.ui-m-sheet__close {
  position: absolute;
  top: 10px;
  right: 8px;
  z-index: 1;
}

.ui-m-sheet__body {
  padding: 0 var(--space-4) var(--space-4);
  font-variant-numeric: tabular-nums;
}

.ui-m-sheet__head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  padding-right: 40px;
}

.ui-m-sheet__img {
  width: 72px;
  height: 72px;
}

/* A provider's 48 px mark in the picture's 72 px column (task 163, /Admin/Providers' sheet): centred, as a photo is. */
.ui-m-sheet__head > .ui-provider {
  justify-self: center;
}

/* A head with no picture (task 119: an account; a provider has its mark since task 163): the title takes the whole width. */
.ui-m-sheet__head--text {
  grid-template-columns: minmax(0, 1fr);
}

/* The title and its line beside the picture (task 121: eight sheets wrapped them in this class and no file described it).
   A grid cell: min-width 0 lets an unbroken name — a minifigure's number, an e-mail — wrap instead of widening the sheet. */
.ui-m-sheet__name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ui-m-sheet__title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}

.ui-m-sheet__sub {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.ui-m-sheet__body > .set-tags {
  margin-top: var(--space-3);
}

.ui-m-sheet__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  margin-top: var(--space-4);
}

.ui-m-sheet__hero > span:first-child {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.ui-m-sheet__hero b {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ui-m-sheet__hero span:not(:first-child) {
  font-size: var(--text-md);
  font-weight: 600;
}

/* Key–value in two columns: a small grey key over a figure, an optional <small> line under it. */
.ui-m-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3) var(--space-4);
  margin: var(--space-4) 0 0;
}

.ui-m-kv dt {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.ui-m-kv dd {
  margin: 1px 0 0;
  font-size: var(--text-md);
  font-weight: 600;
}

.ui-m-kv dd small {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.ui-m-sheet__h {
  margin: var(--space-5) 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ui-m-sheet__h + .ui-m-kv {
  margin-top: 0;
}


.ui-m-sheet__actions {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.ui-m-sheet__actions .ui-btn {
  width: 100%;
}

.ui-m-sheet__danger {
  --btn-fg: var(--down);
}

.ui-m-sheet__danger:hover {
  color: var(--down);
}

/* Secondary actions two to a line under the main ones (task 116); an odd last one takes the whole line. */
.ui-m-sheet__pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.ui-m-sheet__pair > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* A sentence in a sheet or a form: a note, a listing's title, a date line — small and grey. */
.ui-m-sheet__note {
  margin: var(--space-3) 0 0 !important;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  text-wrap: pretty;
}

.ui-m-sheet__h + .ui-m-sheet__note {
  margin-top: 0 !important;
}

/* ── Bottom sheet, «menu / choice»: a title, a list of items (the current one ✓), key–value, buttons ── */
.ui-m-menu {
  padding: 0 var(--space-4) var(--space-3);
}

.ui-m-menu__title {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-lg);
  font-weight: 700;
}

.ui-m-menu__list {
  display: grid;
}

/* A link or a button (a form's submit, the inbox card's «Позначити прочитаним», task 139): the button's own box reset. */
.ui-m-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-lg);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-m-menu__list > .ui-m-menu__item + .ui-m-menu__item {
  box-shadow: inset 0 1px 0 var(--border);
}

.ui-m-menu__item:hover {
  color: var(--text);
}

.ui-m-menu__item:active {
  opacity: 0.6;
}

.ui-m-menu__item svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent-text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}

.ui-m-menu__item[aria-current="true"] {
  color: var(--accent-text);
  font-weight: 600;
}

.ui-m-menu__item[aria-current="true"] svg {
  visibility: visible;
}

.ui-m-menu__kv {
  margin: var(--space-2) 0 var(--space-3);
}

.ui-m-menu__kv:empty {
  display: none;
}

.ui-m-menu__actions {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.ui-m-menu__actions .btn {
  width: 100%;
}

.ui-m-menu__disclosure {
  box-shadow: inset 0 1px 0 var(--border), inset 0 -1px 0 var(--border);
}

.ui-m-menu__disclosure > summary::-webkit-details-marker {
  display: none;
}

.ui-m-menu__disclosure > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  rotate: 45deg;
  transition: rotate var(--duration-2) var(--ease);
}

.ui-m-menu__disclosure[open] > summary::after {
  rotate: -135deg;
}

.ui-m-menu__disclosure p {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-wrap: pretty;
}

/* ── Filter pills under the bar: «Теми ▾», «Фільтри ²», an active search «…» × (task 114). A .ui-chiprow: past the
   width it scrolls sideways rather than squeezing a label. 44 px tall for the finger, a 32 px pill drawn inside;
   --set when the filter narrows the list. Each opens a menu sheet (popovertarget) or, --clear, is the link that drops
   it. The count is the current tab's, in the bar above. ── */
.ui-m-filters {
  max-width: none;
  margin: 2px calc(-1 * var(--m-gutter)) 0;
  padding: 0 var(--m-gutter);
  scroll-padding-inline: var(--m-gutter);
}

.ui-m-filter {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--touch);
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ui-m-filter::before {
  content: "";
  position: absolute;
  inset: 6px 0;
  z-index: -1;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  transition: transform var(--duration-1) var(--ease), background-color var(--duration-1) var(--ease);
}

/* A chevron: it opens a sheet. */
.ui-m-filter:not(.ui-m-filter--clear)::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 1px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  rotate: 45deg;
  opacity: 0.6;
}

.ui-m-filter:hover {
  color: var(--text);
}

.ui-m-filter:active::before {
  transform: scale(0.96);
}

.ui-m-filter--set {
  color: var(--accent-text);
}

.ui-m-filter--set::before {
  background: var(--surface-3);
  box-shadow: none;
}

.ui-m-filter--set:hover {
  color: var(--accent-text);
}

.ui-m-filter:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -4px;
  border-radius: var(--radius-pill);
}

.ui-m-filter__label {
  overflow: hidden;
  max-width: 9.5em;
  text-overflow: ellipsis;
}

.ui-m-filter__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.6875rem;
  font-weight: 700;
}

.ui-m-filter svg {
  flex: none;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── A grid of photo cards, two a row (task 114, the catalogue): the photo on --photo-bg with a −% badge, a name in two
   lines, the chips, then the price large and its reference under it at the card's foot. The card is a link; it sinks a
   little under the finger; ♡ over the photo's corner (.ui-wish, task 192) is its one other target — the card's sheet
   and its ⋯ went. Cards in a row share a height, the price sits on the same line in each. ── */
.ui-m-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.ui-m-grid > .ui-m-empty {
  grid-column: 1 / -1;
}

/* Figures (task 118 on /Minifigures; shared since task 178 with the catalogue's «Мініфігурки»): a figure is a tall
   narrow picture, so three a row on a square photo — six whole on a 390 px screen under a summary, each picture
   ≈ 100 px tall (a 116.7 px tile less --photo-inset's 8 px a side, task 128; the grid decided from shots118/). */
.ui-m-grid--figures {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ui-m-grid--figures .ui-m-card__media {
  aspect-ratio: 1;
  margin-bottom: 6px;
}

.ui-m-grid--figures .ui-m-card__link {
  padding-bottom: 8px;
}

.ui-m-grid--figures .ui-m-card__title,
.ui-m-grid--figures .ui-m-card__sub,
.ui-m-grid--figures .ui-m-card__price,
.ui-m-grid--figures .ui-m-card__tags {
  padding: 0 8px;
}

.ui-m-grid--figures .ui-m-card__title {
  font-size: var(--text-sm);
  line-height: 1.25;
}

.ui-m-grid--figures .ui-m-card__price {
  flex-wrap: wrap;
  column-gap: 4px;
  row-gap: 0;
  padding-top: 6px;
}

.ui-m-grid--figures .ui-m-card__price b {
  font-size: var(--text-md);
}

/* Two chips side by side with a gap, the second under the first when the tile is too narrow (task 182's «у наборі» and
   «окремо» on a 116 px tile). */
.ui-m-grid--figures .ui-m-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.ui-m-card {
  position: relative;
  min-width: 0;
  border-radius: var(--radius-3);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  transition: transform var(--duration-1) var(--ease);
}

.ui-m-card:has(> .ui-m-card__link:active) {
  transform: scale(0.97);
}

.ui-m-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 10px;
  border-radius: inherit;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  /* A press is the set page (task 192): no link preview (the owner's «маленький попап») and no text selection. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.ui-m-card__link:hover {
  color: var(--text);
}

.ui-m-card__link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.ui-m-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-3) var(--radius-3) 0 0;
  background: var(--photo-bg);
  /* In the light theme the card is white too: a hairline is where the photo ends. */
  box-shadow: inset 0 -1px 0 var(--border);
}

.ui-m-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  padding: var(--photo-inset);
  object-fit: contain;
}

/* The deal's «−58.8 %», on the photo (white in both themes): the up colour filled, the page's background as its text. */
.ui-m-card__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-1);
  background: var(--up);
  color: var(--bg);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.5;
}

.ui-m-card__title,
.ui-m-card__sub,
.ui-m-card__price,
.ui-m-card__ref,
.ui-m-card__tags {
  padding: 0 10px;
}

.ui-m-card__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.ui-m-card__sub {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-m-card__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: auto;
  padding-top: var(--space-2);
  white-space: nowrap;
}

.ui-m-card__price small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}

.ui-m-card__price b {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.ui-m-card__price--none {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.ui-m-card__ref {
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.ui-m-card__ref s {
  text-decoration-thickness: 1px;
}

/* _SetTags' row: the reader's «✓ …» and the signal, the second under the first when the card is too narrow. 0.75rem
   (11.25 px), the floor impeccable's detector reads for a label; it was 0.6875 (10.3 px). */
.ui-m-card__tags {
  display: flex;
  min-height: 20px;
  margin-top: 6px;
}

.ui-m-card__tags .tag {
  overflow: hidden;
  min-height: 20px;
  padding: 0 6px;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Choices in a menu sheet: a wrapping grid of 44 px chips, the current one filled (aria-current) — the year ── */
.ui-m-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
}

.ui-m-choice {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  height: var(--touch);
  color: var(--text);
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-m-choice::before {
  content: "";
  position: absolute;
  inset: 4px 0;
  z-index: -1;
  border-radius: var(--radius-2);
  background: var(--surface-2);
  transition: transform var(--duration-1) var(--ease);
}

.ui-m-choice:hover {
  color: var(--text);
}

.ui-m-choice:active::before {
  transform: scale(0.95);
}

.ui-m-choice[aria-current="true"] {
  color: var(--accent-contrast);
  font-weight: 700;
}

.ui-m-choice[aria-current="true"]::before {
  background: var(--accent);
}

.ui-m-choice:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  border-radius: var(--radius-2);
}

/* A menu item's count, before its ✓; an item one level in (a theme's sub-themes). */
.ui-m-menu__count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* A disclosure's chevron is narrower than the ✓: its count moves in by the difference, so counts line up. */
.ui-m-menu__disclosure > summary .ui-m-menu__count {
  margin-right: 6px;
}

.ui-m-menu__item--sub {
  padding-left: var(--space-4);
  font-size: var(--text-md);
}

/* ── A day's (or any group's) heading over its rows, held under the bar while they scroll past (task 116) ── */
.ui-m-section:has(> .ui-m-bar) {
  --m-bar: var(--touch);
}

.ui-m-group {
  position: sticky;
  top: calc(var(--m-header) + var(--m-bar, 0px));
  z-index: 5;
  margin: var(--space-3) calc(-1 * var(--m-gutter)) 0;
  padding: var(--space-2) var(--m-gutter) var(--space-1);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Choices as a list (--list, task 116, «Не цікаво»): the same .ui-m-choices / .ui-m-choice, as 56 px rows a finger
   picks — a <fieldset> of <label>s, each a radio or checkbox and its words (__text) with a hint under them; __more is
   what a choice needs more of (a price), shown under it only while it is checked. The chips above are links that
   navigate; these are form fields that post — and a chip can be a form field too (a radio inside it, task 119, below). ── */
.ui-m-choices--list {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.ui-m-choices--list + .ui-m-choices--list {
  margin-top: var(--space-3);
}

.ui-m-choices--list > legend {
  padding: 0;
}

.ui-m-choices--list .ui-m-choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: auto;
  min-height: 56px;
  padding: var(--space-2) 0;
  cursor: pointer;
}

.ui-m-choices--list .ui-m-choice::before {
  content: none;
}

.ui-m-choices--list .ui-m-choice + .ui-m-choice,
.ui-m-choices--list .ui-m-choice__more + .ui-m-choice {
  box-shadow: inset 0 1px 0 var(--border);
}

.ui-m-choice > input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.ui-m-choice__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ui-m-choice__text small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 400;
  text-wrap: pretty;
}

.ui-m-choice:has(> input:checked) .ui-m-choice__text {
  font-weight: 600;
}

.ui-m-choice:has(> input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-2);
}

.ui-m-choices--list .ui-m-choice:active {
  opacity: 0.7;
}

.ui-m-choice__more {
  display: none;
  padding: 0 0 var(--space-3) calc(22px + var(--space-3));
}

.ui-m-choice:has(> input:checked) + .ui-m-choice__more {
  display: block;
}

/* The sheet's own buttons — «Скинути», «Застосувати» — held at its foot while its list scrolls (task 117); the main one on
   the right. */
.ui-m-menu__foot {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  gap: var(--space-2);
  margin: var(--space-3) calc(-1 * var(--space-4)) calc(-1 * var(--space-3));
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  box-shadow: 0 -1px 0 var(--border);
}

.ui-m-menu__foot .ui-btn {
  flex: 1 1 0;
}

@media (prefers-reduced-motion: reduce) {
  .ui-m-row__link,
  .ui-m-tile,
  .ui-m-fab,
  .ui-m-range::before,
  .ui-m-card,
  .ui-m-filter::before,
  .ui-m-choice::before,
  .ui-m-cell {
    transition: none;
  }

  .ui-m-tile:active,
  .ui-m-fab:active,
  .ui-m-fab.is-away,
  .ui-m-range:active::before,
  .ui-m-card:has(> .ui-m-card__link:active),
  .ui-m-filter:active::before,
  .ui-m-choice:active::before {
    transform: none;
  }
}

/* ── Choices that are form fields, as chips (task 119): a radio or checkbox inside a .ui-m-choice, the chip filled while
   it is checked — a set's status and a copy's state, a role. The input covers the chip, invisible, so the chip is the
   target and the keyboard still reaches it. --row: one line of equal chips, however many there are. ── */
.ui-m-choices:not(.ui-m-choices--list) > .ui-m-choice > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ui-m-choices:not(.ui-m-choices--list) > .ui-m-choice:has(> input) {
  padding: 0 var(--space-1);
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ui-m-choices:not(.ui-m-choices--list) > .ui-m-choice:has(> input:checked) {
  color: var(--accent-contrast);
  font-weight: 700;
}

.ui-m-choices:not(.ui-m-choices--list) > .ui-m-choice:has(> input:checked)::before {
  background: var(--accent);
}

.ui-m-choices--row {
  grid-template-columns: none;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  margin-bottom: 0;
}

/* ── Cells: a screen of settings as inset groups of rows (task 119, /Settings, /Account, /Admin/Users, the edit form).
   A row is a link to a screen or a sheet (--nav, a chevron), a switch, a field beside its label, a field under it
   (--stack), fields side by side (--grid), or a button (--danger red). 52 px at least; a hairline above every row but
   the first, from the text (`~`, not `+`: a row's <template> or a hidden input may sit between). --flat inside a sheet,
   which is the surface already. ── */
.ui-m-cells {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-3);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
  list-style: none;
  overflow: hidden;
}

.ui-m-cells + .ui-m-cells,
form + .ui-m-cells {
  margin-top: var(--space-3);
}

.ui-m-cells--flat {
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}

.ui-m-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-lg);
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-m-cells--flat > .ui-m-cell {
  padding-inline: 0;
}

.ui-m-cell ~ .ui-m-cell::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: var(--space-4);
  height: 1px;
  background: var(--border);
}

.ui-m-cells--flat > .ui-m-cell ~ .ui-m-cell::before {
  left: 0;
}

a.ui-m-cell,
button.ui-m-cell,
label.ui-m-cell {
  cursor: pointer;
  transition: background-color var(--duration-2) var(--ease);
}

a.ui-m-cell:hover,
button.ui-m-cell:hover {
  color: var(--text);
}

/* The press shows at once, under the finger. */
a.ui-m-cell:active,
button.ui-m-cell:active,
label.ui-m-cell:active {
  background: var(--surface-2);
  transition-duration: 0ms;
}

a.ui-m-cell:focus-visible,
button.ui-m-cell:focus-visible,
.ui-m-cell:has(> .ui-switch input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.ui-m-cell__text {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ui-m-cell__text small {
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
  text-wrap: pretty;
}

.ui-m-cell__value {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 55%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: var(--text-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A link to a screen or a sheet: a chevron at the end. */
.ui-m-cell--nav::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin: 0 2px 0 -2px;
  border-top: 2px solid var(--text-faint);
  border-right: 2px solid var(--text-faint);
  rotate: 45deg;
}

.ui-m-cell--danger,
.ui-m-cell--danger:hover {
  color: var(--down);
}

/* A field beside its label: a fixed width on the right, the figure right-aligned. */
.ui-m-cell:not(.ui-m-cell--stack) > .ui-input,
.ui-m-cell:not(.ui-m-cell--stack) > .ui-select {
  flex: 0 0 auto;
  width: 9.5rem;
}

.ui-m-cell:not(.ui-m-cell--stack) > .ui-input {
  text-align: right;
}

.ui-m-cell textarea.ui-input {
  height: auto;
  min-height: calc(var(--control-md) * 2);
  padding-block: var(--space-2);
  resize: vertical;
}

/* A field under its label (a password, a token, a link to copy), or fields side by side. */
.ui-m-cell--stack {
  display: grid;
  align-items: stretch;
  gap: var(--space-1);
  padding-block: var(--space-3);
}

.ui-m-cell--grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  align-items: end;
  gap: var(--space-2) var(--space-3);
  padding-block: var(--space-3);
}

/* A date field's own width would push its neighbour aside. */
.ui-m-cell--grid .ui-input,
.ui-m-cell--grid .ui-select {
  min-width: 0;
}

/* A line inside a stacked cell: chips and a button beside them. */
.ui-m-cell__line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.ui-m-cell__line > .ui-m-choices {
  flex: 1 1 auto;
  min-width: 0;
}

/* A switch at the end of a row: the label is the whole row, the switch a phone's size. */
.ui-m-cell > .ui-switch {
  flex: none;
  min-height: 0;
}

.ui-m-cell > .ui-switch input {
  width: 46px;
  height: 28px;
}

.ui-m-cell > .ui-switch input::before {
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
}

.ui-m-cell > .ui-switch input:checked::before {
  translate: 18px 0;
}

/* A sub-screen of one page (task 119, /Settings' sections): the index of rows linking to #id is shown until a screen
   is the URL's target, then that screen alone — the back gesture and «‹» are the browser's own history (phone.js). */
.ui-m-screen {
  display: none;
  scroll-margin-top: var(--m-header);
}

.ui-m-screen:target {
  display: block;
}

[data-phone-screens]:has(.ui-m-screen:target) .ui-m-screens__index {
  display: none;
}

/* Up and down: the summary's pair, a row's change, a tile's value. (0,1,0) and last in the file, so it beats a part's own
   grey at equal specificity only — a rule that colours one of these at (0,2,0) would win. */
.ui-m-up { color: var(--up); }
.ui-m-down { color: var(--down); }

/* /Design shows them in its page at any width: the bar not held, «+» in the flow. */
.ui-m-bar--inline {
  position: static;
}

.ui-m-fab--inline {
  position: static;
}

.ui-m-group--inline {
  position: static;
}
