/* 04-collection.css — my sets, shared data tables, refresh bar.
   Part of the former single site.css. These files are ORDER-DEPENDENT: they are linked in
   numeric order in _Layout.cshtml and later rules still override earlier ones exactly as they
   did in the one big file. Do not reorder the <link> tags. */

.my-set-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  background: var(--muted);
}
.my-set-dot--status-wishlist  { background: var(--border); }
.my-set-dot--status-ordered   { background: #667eea; }
.my-set-dot--status-purchased { background: #48bb78; }
.my-set-dot--status-used      { background: #ed8936; }
.my-set-dot--status-sold      { background: #fc8181; }

.my-sets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.my-sets-grid--collection {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1600px) {
  .my-sets-grid--collection {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1300px) {
  .my-sets-grid--collection {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .my-sets-grid--collection {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .my-sets-grid--collection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .my-sets-grid--collection {
    grid-template-columns: 1fr;
  }
}
/* The /MySets card (task 082): one card top to bottom, no box inside it — sections are split by spacing and two
   hairlines. Each card is EIGHT rows of the grid's own tracks (subgrid): image, name, chips, the value with its PnL,
   the key–value list, the trend, forecast and notes, the buttons — so a row of cards starts every section at the same
   height (measured 0 px; before, the trend stood up to 70 px apart at 1 440 and 94 at 2 000). Without subgrid the
   card is a plain column and just does not align. A new section needs a row here and in _Cards.cshtml. */
.my-set-card {
  display: grid;
  grid-row: span 8;
  grid-template-rows: subgrid;
  row-gap: 8px;
  min-width: 0;
  padding-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.16s ease;
}
.my-set-card:hover {
  border-color: var(--border);
}
.my-set-card > :not(.my-set-card__image) {
  min-width: 0;
  margin: 0 14px;
}
/* 120 px (was 168 at 1 440: a 16:9 box with a 168 px floor); the img keeps its width/height attributes (task 052). */
.my-set-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  padding: 10px;
  background: var(--photo-bg);
  border-bottom: 1px solid var(--border);
}
.my-set-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* The number sits on the name's line, as in the table; two lines at most. */
.my-set-card__head {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.3;
}
.my-set-card__name {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.my-set-card__name:hover { text-decoration: underline; }
/* The head clips its overflow for the clamp, so the ring goes inside. */
.my-set-card__name:focus-visible { outline-offset: -2px; }
.my-set-card__number {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
/* The headline: the value large, the PnL in PLN and % at the right, the cost and the purchase under them. */
.my-set-card__headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.my-set-card__value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}
.my-set-card__pnl {
  display: grid;
  justify-items: end;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.my-set-card__cost {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
}
/* Key–value rows, Binance's «market info»: the label left, the figure right, a note after it. */
.my-set-card__kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 3px 8px;
  font-size: 0.8rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.my-set-card__kv > div {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
}
.my-set-card__kv dt {
  color: var(--muted);
  font-weight: 500;
}
.my-set-card__kv dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.my-set-card__kv .kv__note {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.my-set-card__kv .kv__sub {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}
.my-set-card > .price-trend,
.my-set-card__forecast {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.my-set-card__extra {
  display: grid;
  align-content: start;
  gap: 6px;
}
.my-set-card__notes {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}
.my-set-card__forecast-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.my-set-card__forecast-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}
.my-set-card__forecast-confidence {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
/* The 12-month range («651 – 761», «−13.5 … +1.1 %») gets the widest column; at a third it broke before «%». */
.my-set-card__forecast-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 6px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.my-set-card__forecast-grid dt {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}
.my-set-card__forecast-grid dd {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}
.my-set-card__forecast-grid .my-set-card__forecast-change {
  font-weight: 600;
}
/* Task 059: the 12-month cell is a range; the caveat sits under the three cells. */
.my-set-card__forecast-note {
  margin-top: 4px;
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
}
.my-set-card__actions {
  display: flex;
  gap: 8px;
}
.my-set-card__actions .btn {
  flex: 1 1 0;
  justify-content: center;
  border-radius: 8px;
}

/* The edit form lives in 11-edit-panel.css (task 044). */
.empty-state-inline { text-align: center; padding: 48px 0; color: var(--muted); }
.empty-state-inline p { margin-bottom: 16px; }

/* ── Shared refresh bar ──────────────────────────── */
.refresh-bar,
.my-sets-refresh-bar {
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--info-bg), var(--info-bg));
  border: 1px solid color-mix(in srgb, var(--info) 35%, var(--surface-1));
  border-radius: 10px;
  overflow: hidden;
  animation: refresh-bar-in 0.25s ease;
}

@keyframes refresh-bar-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.refresh-bar__inner {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.refresh-bar__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--info);
}

.refresh-bar__spin {
  width: 18px; height: 18px;
  animation: spin 1s linear infinite;
  flex: 0 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.refresh-bar__progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refresh-bar__track {
  flex: 1;
  height: 6px;
  background: rgba(43, 108, 243, 0.15);
  border-radius: 99px;
  overflow: hidden;
}

.refresh-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #2b6cf3, #5b93f7);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(.25,.8,.25,1);
}

.refresh-bar__counter {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--info);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.refresh-bar__error {
  font-size: 0.78rem;
  color: var(--down);
  background: var(--down-bg);
  border-radius: 6px;
  padding: 6px 10px;
}

/* /MySets: the explanations shared by every card, printed once above the grid (task 052). */
.my-sets-legend {
  margin: -8px 0 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.my-sets-legend summary {
  cursor: pointer;
  width: fit-content;
}

.my-sets-legend dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 8px 0 0;
  max-width: 900px;
}

.my-sets-legend dt {
  font-weight: 700;
}

.my-sets-legend dd {
  margin: 0;
}

.btn-sort {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.btn-sort:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-sort.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* Shared data table — the collection's (the wishlist's went in task 162); keep page-specific bits in a modifier */
.data-table-card {
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.data-table-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.data-table-card__head h2 {
  margin: 0;
  font-size: 1rem;
}

.data-table-card__head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.data-table-card__head > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--surface);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
}

.data-table .actions {
  text-align: right;
  white-space: nowrap;
}

/* Sales windows strip (set details → market analytics) */
.sales-windows {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
}

.sales-windows__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sales-windows__title {
  font-size: 0.9rem;
  font-weight: 800;
}

.sales-windows__pace {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.sales-windows__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.sales-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: center;
}

.sales-window--empty {
  opacity: 0.55;
}

.sales-window__label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sales-window__value {
  margin-top: 3px;
  font-size: 1.15rem;
  font-weight: 900;
}

.sales-window__value span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.sales-window__deals {
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 640px) {
  .sales-windows__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.gain--pos { color: var(--up); }
.gain--neg { color: var(--down); }

/* The trend block of /MySets and /Wishlist (_PriceTrend.cshtml, task 077), exchange-style: 1Д · 7Д · 30Д · 3М in
   a row, the percent the figure, the PLN change under it, a 3-month sparkline below. No box around a horizon and
   no arrow: the sign and the colour say the direction. The pair is the theme's --up / --down (task 100: ≥ 4.5:1 on
   every surface in both themes, DesignSystemTests). */
.price-trend {
  --trend-up: var(--up);
  --trend-down: var(--down);
  display: grid;
  gap: 4px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.price-trend__grid {
  display: grid;
  /* max-content, not 0: in an auto-width table cell a 0 minimum collapsed the block to 66 px. */
  grid-template-columns: repeat(4, minmax(max-content, 1fr));
  gap: 0 6px;
  margin: 0;
}

.price-trend__h {
  min-width: 0;
  white-space: nowrap;
}

.price-trend__h dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.price-trend__h dd {
  margin: 0;
}

.price-trend__pct {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.price-trend__net {
  font-size: 0.7rem;
  font-weight: 500;
}

.price-trend--up { color: var(--trend-up); }
.price-trend--down { color: var(--trend-down); }
.price-trend--flat,
.price-trend--none { color: var(--muted); }
.price-trend--none .price-trend__pct { font-weight: 500; }

.price-trend__spark {
  display: block;
  width: 100%;
  height: 20px;
}

.price-trend__spark polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* ── /MySets, exchange-style (task 078) ──────────────────────────────
   Scoped by .mysets-page. Up/down are the 077 pair everywhere on the page — the header, PnL, the cards' gain and
   pill — so one row no longer carries two greens and two reds. Since task 100 they are the theme's --up / --down
   and --muted the theme's own (it was a darker #556070 here, for the light-only page). */
.mysets-page {
  --trend-up: var(--up);
  --trend-down: var(--down);
}

.mysets-page + .mysets-page {
  margin-top: 18px;
}

.mysets-page .pnl--up,
.mysets-page .gain--pos { color: var(--trend-up); }
.mysets-page .pnl--down,
.mysets-page .gain--neg { color: var(--trend-down); }

.assets-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.assets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.assets-bar h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.assets-tabs,
.assets-view,
.assets-sorts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.assets-view {
  margin-left: auto;
}

.assets-sorts {
  padding: 10px 16px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.assets-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: max(32px, var(--control-sm));
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.assets-tab span {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.assets-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.assets-tab.is-active {
  background: var(--text);
  color: var(--surface-1);
}

.assets-tab.is-empty {
  opacity: 0.55;
}

.assets-search {
  display: flex;
  gap: 6px;
}

/* Every page's search field (task 186, _PageSearch): wide enough for its placeholder. */
.assets-search .page-search {
  width: 16rem;
}

.assets-card .empty-state-inline {
  padding: 24px 16px;
}

.assets-card > .my-sets-legend,
.assets-card > .my-sets-grid {
  margin: 12px 16px 16px;
}

/* position: relative makes the wrap the containing block of the table's absolutely positioned .visually-hidden spans
   («Дії», the market's pace words): without it they hung past its scroll and widened the PAGE — 1 167 px at 901, 1 024
   and 1 100 while the wrap scrolled on its own (task 134). Whatever the table's width, only the wrap scrolls. */
.assets-table-wrap {
  position: relative;
  overflow-x: auto;
}

/* The asset cell takes what the right-aligned figures leave; under 1 220 px two columns go (below). */
.assets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.assets-table th,
.assets-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.assets-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.assets-table .num {
  text-align: right;
  white-space: nowrap;
}

.assets-table tbody tr:hover {
  background: var(--surface);
}

.assets-table tbody tr:last-child td {
  border-bottom: 0;
}

.assets-sort {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.assets-sort small {
  font-size: 0.68rem;
  font-weight: 600;
}

.assets-sort i {
  font-style: normal;
  opacity: 0.6;
}

.assets-sort.is-active {
  color: var(--text);
}

.assets-sort.is-active i {
  opacity: 1;
}

.assets-table td.num b {
  display: block;
  font-weight: 700;
}

.assets-table td.num small,
.assets-mkt small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

/* «немає цін вживаних» in two lines: on one it took 40 px off the names (task 175, 1 280). */
.assets-table td.num small.assets-note {
  white-space: normal;
}

.assets-table td.num small.pnl--up { color: var(--trend-up); }
.assets-table td.num small.pnl--down { color: var(--trend-down); }

.assets-table td.asset {
  min-width: 240px;
}

.asset__img {
  float: left;
  width: 40px;
  height: 40px;
  margin-right: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--photo-bg);
  overflow: hidden;
}

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

.asset__main {
  overflow: hidden;
}

.asset__name {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.asset__name:hover {
  text-decoration: underline;
}

.asset__num {
  color: var(--muted);
  font-size: 0.76rem;
}

.asset .set-tags {
  margin-top: 4px;
}

.assets-table td.trend {
  width: 250px;
}

.assets-mkt {
  font-size: 0.78rem;
}

/* The market cell is a small order book (task 081): the label left in grey, the figure right. Four lines at most
   (ask, its premium, stock, sold) fit the 71 px the trend block already gives a row. */
.assets-mkt .mkt {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 10px;
  align-items: baseline;
  margin: 0;
}

.assets-mkt .mkt dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  text-align: left;
}

.assets-mkt .mkt dd {
  margin: 0;
  text-align: right;
}

.assets-mkt .mkt__ask {
  font-weight: 700;
}

.assets-mkt .mkt__sub {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.7rem;
}

.assets-mkt .mkt__pace {
  margin-left: 3px;
}

.mkt__pace {
  font-weight: 700;
}

.assets-table .act {
  white-space: nowrap;
  text-align: right;
}

.assets-table .act form {
  display: inline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
}

.icon-btn:hover,
.icon-btn:focus-visible:not([data-focus-quiet]) {
  border-color: var(--accent);
  color: var(--accent-text);
}

.icon-btn--danger:hover,
.icon-btn--danger:focus-visible {
  border-color: var(--trend-down);
  color: var(--trend-down);
}

/* Fits from 901 px with no sideways scroll. All nine columns at their narrowest are 1 156 px on the owner's 65 sets — the
   wrap has 1 178 at 1 220 —, so under that the BrickLink market (the secondary column, task 081) goes, and under 1 080
   the cost too (PnL keeps the difference) with the set's cell from 240 to 200 px: 824 px in an 859 px wrap at 901
   (task 134). The cards view keeps every figure. */
@media (min-width: 901px) and (max-width: 1219.98px) {
  .assets-table .assets-mkt {
    display: none;
  }
}

@media (min-width: 901px) and (max-width: 1079.98px) {
  .assets-table .assets-cost {
    display: none;
  }
  .assets-table td.asset {
    min-width: 200px;
  }
}

/* 390 px: no table at full width — each row is a two-line item: the asset and its value/PnL, then the trend; the
   cost, the BrickLink market and the column heads are not drawn (the cards view keeps every figure). */
/* The phone's «Сортувати за» (task 105): there only. */
.assets-sort-form {
  display: none;
}

/* The list (≤ 900 px since task 105; 760 before — at 768 the table pushed the page to 1 195 px): one row a holding,
   the tabs a row that scrolls on its own, the sort a select. */
@media (max-width: 900px) {
  .assets-bar {
    padding: 10px 12px;
  }
  .assets-tabs {
    flex-wrap: nowrap;
    flex: 1 1 100%;
    order: 1;
  }
  .assets-bar h2 {
    order: 0;
  }
  .assets-search {
    order: 2;
    flex: 1 1 100%;
  }
  .assets-sort-form {
    order: 3;
    display: flex;
    flex: 1 1 auto;
    gap: 6px;
    margin: 0;
  }
  .assets-sort-form__field {
    flex: 1 1 auto;
  }
  .assets-view {
    order: 4;
  }
  .assets-table td.asset .asset__img {
    width: var(--touch);
    height: var(--touch);
  }
  .assets-card .icon-btn {
    width: var(--touch);
    height: var(--touch);
  }
  /* A card's name is its link: 24 px tall at least (WCAG 2.5.8). */
  .my-set-card__name {
    display: inline-block;
    line-height: 24px;
  }
  .assets-view {
    margin-left: 0;
  }
  .assets-search,
  .assets-search .page-search {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  .assets-table thead {
    display: none;
  }
  .assets-table,
  .assets-table tbody {
    display: block;
  }
  .assets-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .assets-table td {
    display: block;
    padding: 0;
    border: 0;
  }
  .assets-table td.asset {
    display: block;
    grid-column: 1;
    grid-row: 1 / span 2;
    min-width: 0;
  }
  .assets-table td:nth-child(2),
  .assets-table td:nth-child(3),
  .assets-table td:nth-child(5),
  .assets-table td.assets-mkt {
    display: none;
  }
  .assets-table td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
  }
  .assets-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 2;
  }
  .assets-table td.trend {
    grid-column: 1 / -1;
    width: auto;
    margin-top: 6px;
  }
  .assets-table td.act {
    grid-column: 1 / -1;
  }
}

/* Analytics screener table */
.analytics-table-wrap { overflow-x: auto; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.analytics-table th, .analytics-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.analytics-table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 700; }
.analytics-table th.num, .analytics-table td.num { text-align: right; }
.analytics-table tbody tr:hover { background: var(--surface-2, #f7f8fa); }
.analytics-set { display: flex; align-items: center; gap: 10px; text-decoration: none; max-width: 100%; white-space: normal; }
.analytics-set__thumb {
  flex: 0 0 46px;
  width: 46px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--photo-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.analytics-set__thumb img {
  width: 100%;
  height: 100%;
  padding: var(--photo-inset);
  object-fit: contain;
}
.analytics-set__text { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.analytics-set__num { font-size: 0.72rem; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.analytics-rel { font-size: 0.66rem; padding: 0 6px; min-height: 18px; }
.analytics-rel--wish { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 35%, var(--surface-1)); color: var(--info); }
.analytics-set__name {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 600;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* /Settings (task 170): one column of groups in the phone's order, rows of a label and its control — no tabs, no
   explanatory lines. A sticky list of the groups on the left from 1 101 px; «Зберегти» held at the bottom of the window
   while the form is on screen. Every control is a .ui- component; this is layout. */
.settings-page {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  gap: var(--space-6);
  justify-content: center;
}

.settings-nav {
  display: none;
}

@media (min-width: 1101px) {
  .settings-page {
    grid-template-columns: 180px minmax(0, 760px);
  }

  .settings-nav {
    position: sticky;
    top: calc(var(--app-header) + var(--space-6));
    align-self: start;
    display: grid;
    gap: var(--space-1);
    padding-top: 52px; /* level with the first group's title, under the page's h1 */
  }

  .settings-nav a {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-2);
    color: var(--text-muted);
    font-size: var(--text-md);
    text-decoration: none;
  }

  .settings-nav a:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

.settings-main {
  min-width: 0;
}

.settings-main__title {
  margin: 0 0 var(--space-5);
  font-size: var(--text-2xl);
}

.settings-status {
  background: var(--up-bg);
  color: var(--up);
  border-radius: var(--radius-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  font-size: var(--text-md);
}

/* The validation summary is always rendered; ASP.NET marks an empty one "…-valid", which keeps a clean form from a bare red box. */
.settings-status--error {
  background: var(--down-bg);
  color: var(--down);
}

.settings-status--error.validation-summary-valid {
  display: none;
}

.settings-status--error ul {
  margin: 0;
  padding-left: 18px;
}

.settings-section {
  margin-bottom: var(--space-7);
  scroll-margin-top: calc(var(--app-header) + var(--space-4));
}

.settings-section__title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
}

.settings-section__sub {
  margin: var(--space-5) 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* A group of rows on one surface; a hairline between rows. */
.settings-list {
  border-radius: var(--radius-3);
  background: var(--surface-1);
  box-shadow: var(--shadow-1);
}

.settings-list--after {
  margin-top: var(--space-4);
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-height: 48px;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-md);
}

.settings-row + .settings-row {
  box-shadow: inset 0 1px 0 var(--border);
}

label.settings-row {
  cursor: pointer;
}

/* The label takes the room; the control sits at the right end. */
.settings-row__title {
  flex: 1 1 12rem;
  min-width: 0;
  color: var(--text);
}

.settings-row__value {
  color: var(--text-muted);
}

.settings-row__error {
  flex-basis: 100%;
}

.settings-row__error.field-validation-valid {
  display: none;
}

/* A row about the row above (this device under «Браузер», the chat under «Telegram»). */
.settings-row--sub {
  padding-left: var(--space-7);
}

.settings-row--empty {
  color: var(--text-muted);
}

.settings-row--costs > .ui-provider {
  flex: 1 1 12rem;
}

.settings-inline-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.settings-inline-field .ui-input {
  width: auto;
}

.settings-input--short {
  width: 6.5rem !important;
  text-align: right;
}

.settings-input--steps {
  width: 8.5rem !important;
}

.settings-input--text {
  width: 16rem;
}

.settings-input--select {
  width: 10rem;
}

.settings-row input[type="time"] {
  width: 7rem;
}

/* The rule grid: the phase, its switch, three figures. A placeholder here says what blank means («вимк.», «без меж»),
   so it is read, not decoration: --text-muted, not the faint default. */
.settings-rules thead th {
  font-size: var(--text-sm);
  text-transform: none;
  letter-spacing: 0;
}

.settings-rules tbody th {
  font-weight: 500;
}

.settings-input--cell {
  width: 6.5rem;
  text-align: right;
}

.settings-channel .ui-input::placeholder {
  color: var(--text-muted);
}

/* Telegram's own grid and marketplaces: shown while «Інакше для Telegram» is on (posted either way). */
.settings-channel[data-telegram-own="true"] {
  display: none;
}

#settings-form:has(#TelegramOwnRules:checked) .settings-channel[data-telegram-own="true"] {
  display: block;
}

/* A marketplace or a reminder time: a chip with its box inside, filled while ticked. */
.settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-md);
  cursor: pointer;
}

.settings-chip:has(input:checked) {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.settings-chip input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.settings-chip:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* «Додатково»: the two thresholds nobody on the copy had moved from their defaults. */
.settings-more {
  margin-top: var(--space-4);
}

.settings-more > summary {
  width: fit-content;
  padding: var(--space-1) 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.settings-more[open] > summary {
  margin-bottom: var(--space-2);
}

/* «Зберегти»: in the flow on a phone's screen (.ui-sticky-action holds it above the bar ≤ 900 px); from 901 px held at
   the window's bottom while the form is on screen. */
@media (min-width: 901px) {
  /* Tab never walks a field under the held bar. */
  html:has(.settings-save) {
    scroll-padding-bottom: 80px;
  }

  .settings-save {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    margin: 0 calc(-1 * var(--space-4)) var(--space-7);
    padding: var(--space-3) var(--space-4);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(6px);
  }
}

.form-error {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--down);
}

.form-error.field-validation-valid {
  display: none;
}

/* «Браузер» (task 169): this browser's state in one chip, its action, the account's subscribed browsers. */
.settings-push__state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-push__detail {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.settings-push__actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.settings-push__actions:not(:has(> :not([hidden]))) {
  display: none;
}

.settings-push__hint {
  flex-basis: 100%;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.settings-push__hint:empty {
  display: none;
}

.settings-telegram-code {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* The code is to be copied, not an error: the text's colour, not Bootstrap's pink. */
.settings-telegram-code code {
  color: var(--text);
  font-size: var(--text-md);
  user-select: all;
}

.settings-devices > summary {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.settings-devices__list {
  display: grid;
  flex-basis: 100%;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-devices__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.settings-devices__name {
  flex: 1 1 12rem;
}

/* The phone's row: the name and «цей» on one line, the status under them. */
.settings-devices__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ui-m-cell.settings-push {
  margin: 0;
}

/* The phone's phase card: a label that wraps to two lines («Дешевше за ринок, %») must not push its field down. */
.settings-channel .ui-m-cell--grid .ui-field {
  grid-template-rows: 1fr auto auto;
  align-items: end;
}

/* The phone's «Додатково»: its summary is a section heading that opens. */
.app-shell--mobile .settings-more > summary {
  margin: 0;
}

/* «Мобільна версія» under the desktop /MySets (task 109): the way back to the phone's page for someone who switched to
   this one. A phone's width only — from 901 px nobody needs it. */
.device-switch {
  display: flex;
  justify-content: center;
  margin: 0;
}

.device-switch a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

@media (min-width: 901px) {
  .device-switch {
    display: none;
  }
}
