/* v254: the Units group on the Items tab: section headings and the +n / -n badges on unit cards. */
#items-grid .units-head { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 6px 0 0; }
#items-grid .units-head:first-child { margin-top: 0; }
#items-grid .units-head strong { color: #f0edff; font-size: 14px; font-weight: 700; }
#items-grid .units-head small { color: #8a8ea8; font-size: 12px; }
#items-grid .units-head.is-gain strong { color: #72dfb2; }
#items-grid .units-head.is-loss strong { color: #ff8293; }
#items-grid .units-empty { grid-column: 1 / -1; margin: 0; color: #8a8ea8; font-size: 12px; }
#items-grid .items-card.is-unit .items-card-art img { object-fit: cover; border-radius: 8px; }
#items-grid .items-card-count.is-gain { background: #1f8f62; color: #ffffff; }
#items-grid .items-card-count.is-loss { background: #c2384f; color: #ffffff; }
#items-grid .items-card.is-loss .items-card-art img { filter: grayscale(0.7) brightness(0.8); }

/* v291: Units tab redesign (owner approved preview). Tokens from .interface-design/system.md. */
#items-grid .um { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; min-width: 0; --um-secret: linear-gradient(90deg,#ff5a6e,#5a0c1a); --um-mythic: linear-gradient(90deg,#ff8ad8,#7fd8ff); --um-legend: linear-gradient(90deg,#ffd36b,#c98a1c); --um-epic: linear-gradient(90deg,#c6a8ff,#7a52d6); --um-rare: linear-gradient(90deg,#7fd8ff,#3c7fd6); }
#items-grid .um .num { font-variant-numeric: tabular-nums; }
#items-grid .um-ledger, #items-grid .um-panel { background: linear-gradient(165deg, rgb(27 30 54 / 94%), rgb(14 17 32 / 94%)); border: 1px solid rgb(152 140 203 / 20%); border-radius: 16px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%); padding: 16px; min-width: 0; }
#items-grid .um-ledger { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: center; }
#items-grid .um-net small { display: block; font-size: 11px; font-weight: 600; color: #8a8ea8; }
#items-grid .um-net b { display: block; font-size: 40px; line-height: 1.05; font-weight: 800; color: #72dfb2; letter-spacing: -0.02em; }
#items-grid .um-net span { font-size: 12px; color: #b7b6cc; }
#items-grid .um-ribbon { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#items-grid .um-ribbon-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: rgb(8 11 22 / 42%); }
#items-grid .um-ribbon-bar i { display: block; height: 100%; }
#items-grid .um-ribbon-bar .is-gain { background: linear-gradient(90deg, #3fbf8f, #72dfb2); }
#items-grid .um-ribbon-bar .is-loss { background: linear-gradient(90deg, #ff8293, #c4475b); }
#items-grid .um-ribbon-legend { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: #b7b6cc; }
#items-grid .um-ribbon-legend b { font-weight: 800; }
#items-grid .um-ribbon-legend .is-gain b { color: #72dfb2; }
#items-grid .um-ribbon-legend .is-loss b { color: #ff8293; }
#items-grid .um-rar { display: flex; gap: 6px; flex-wrap: wrap; }
#items-grid .um-rar span { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgb(8 11 22 / 42%); border: 1px solid rgb(255 255 255 / 6%); color: #b7b6cc; }
#items-grid .um-rar span i { width: 8px; height: 8px; border-radius: 2px; display: block; background: var(--um-rare); }
#items-grid .um-rar span[data-r=secret] i { background: var(--um-secret); }
#items-grid .um-rar span[data-r=mythic] i { background: var(--um-mythic); }
#items-grid .um-rar span[data-r=legend] i { background: var(--um-legend); }
#items-grid .um-rar b { color: #f0edff; font-weight: 800; }
#items-grid .um-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
#items-grid .um-seg { display: inline-flex; padding: 4px; border-radius: 12px; background: rgb(8 11 22 / 42%); border: 1px solid rgb(255 255 255 / 6%); }
#items-grid .um-seg button { font: inherit; font-size: 13px; font-weight: 700; color: #b7b6cc; background: none; border: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; display: flex; gap: 6px; align-items: center; transition: background-color 120ms ease, color 120ms ease; }
#items-grid .um-seg button:hover { color: #f0edff; }
#items-grid .um-seg button em { font-style: normal; font-size: 11px; font-weight: 700; color: #8a8ea8; }
#items-grid .um-seg button.is-on { background: rgb(198 168 255 / 14%); color: #f0edff; box-shadow: inset 0 0 0 1px rgb(198 168 255 / 30%); }
#items-grid .um-seg button.is-on em { color: #c6a8ff; }
#items-grid .um-seg button:focus-visible, #items-grid .um-chip:focus-visible { outline: 2px solid #7fd8ff; outline-offset: 2px; }
#items-grid .um-chip { font: inherit; font-size: 11px; font-weight: 600; color: #b7b6cc; background: none; border: 1px solid rgb(255 255 255 / 8%); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
#items-grid .um-chip.is-on { color: #f4d38a; border-color: rgb(244 211 138 / 40%); background: rgb(244 211 138 / 8%); }
#items-grid .um-sort { margin-left: auto; font-size: 11px; color: #8a8ea8; }
#items-grid .um-shelf-head { display: flex; align-items: baseline; gap: 10px; margin: 14px 2px 10px; }
#items-grid .um-shelf-head h3 { margin: 0; font-size: 13px; font-weight: 700; color: #f0edff; }
#items-grid .um-shelf-head span { font-size: 12px; color: #8a8ea8; }
#items-grid .um-shelf-head i { flex: 1; height: 1px; background: rgb(255 255 255 / 6%); }
#items-grid .um-grid { display: grid; gap: 10px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
#items-grid .um-grid.is-hero { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#items-grid .um-card { position: relative; border-radius: 14px; overflow: hidden; background: rgb(8 11 22 / 42%); border: 1px solid rgb(255 255 255 / 6%); transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), border-color 160ms ease; }
#items-grid .um-card:hover { transform: translateY(-2px); border-color: rgb(255 255 255 / 14%); }
#items-grid .um-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--um-rare); z-index: 2; }
#items-grid .um-card[data-r=secret]::before { background: var(--um-secret); }
#items-grid .um-card[data-r=secret] { box-shadow: inset 0 0 0 1px rgb(255 90 110 / 22%); }
#items-grid .um-card[data-r=mythic]::before { background: var(--um-mythic); }
#items-grid .um-card[data-r=legend]::before { background: var(--um-legend); }
#items-grid .um-card[data-r=epic]::before { background: var(--um-epic); }
#items-grid .um-art { position: relative; aspect-ratio: 1 / 1; background: #11142a; }
#items-grid .um-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#items-grid .um-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #8a8ea8; }
#items-grid .um-art::after { content: ""; position: absolute; inset: auto 0 0; height: 56%; background: linear-gradient(180deg, transparent, rgb(6 8 18 / 92%)); }
#items-grid .um-stamp { position: absolute; top: 9px; right: 9px; z-index: 3; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgb(6 8 18 / 78%); color: #7fd8ff; box-shadow: inset 0 0 0 1px rgb(127 216 255 / 35%); }
#items-grid .um-stamp.is-gain { color: #72dfb2; box-shadow: inset 0 0 0 1px rgb(114 223 178 / 40%); }
#items-grid .um-stamp.is-loss { color: #ff8293; box-shadow: inset 0 0 0 1px rgb(255 130 147 / 40%); }
#items-grid .um-name { position: absolute; left: 10px; right: 10px; bottom: 9px; z-index: 3; }
#items-grid .um-name b { display: block; font-size: 13px; font-weight: 800; line-height: 1.25; color: #f0edff; text-wrap: balance; }
#items-grid .um-grid.is-hero .um-name b { font-size: 16px; }
#items-grid .um-name small { display: block; font-size: 11px; color: #b7b6cc; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#items-grid .um-tags { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 9px 9px; }
#items-grid .um-tags span { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: rgb(255 255 255 / 5%); color: #b7b6cc; }
#items-grid .um-tags .is-shiny { color: #f4d38a; background: rgb(244 211 138 / 10%); }
#items-grid .um-tags .is-trait { color: #c6a8ff; background: rgb(198 168 255 / 10%); }
#items-grid .um-panel.is-loss .um-card { filter: saturate(0.55); }
#items-grid .um-panel.is-loss .um-card:hover { filter: none; }
#items-grid .um-empty, #items-grid .um-note { margin: 10px 2px 0; font-size: 12px; color: #8a8ea8; }
@media (max-width: 900px) { #items-grid .um-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } #items-grid .um-grid.is-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } #items-grid .um-ledger { grid-template-columns: 1fr; } }
@media (max-width: 520px) { #items-grid .um-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } #items-grid .um-name b { font-size: 12px; } #items-grid .um-sort { margin-left: 0; width: 100%; } }
@media (prefers-reduced-motion: reduce) { #items-grid .um-card { transition: none; } #items-grid .um-card:hover { transform: none; } }

/* v360 (owner: unit pictures too big on a computer): fixed-size cards that fill the row (about 8 per row), also for a short list */
@media (min-width: 901px) {
  #items-grid .um-grid, #items-grid .um-grid.is-hero { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
