/* Pinned assets: one horizontal strip of cards in the visitor's order. When the
   cards outgrow the panel the row scrolls sideways (swipe, trackpad, shift+wheel
   or the edge arrows); the add control stays pinned at the right end.
   Card rules carry no ancestor so the drag preview, a clone appended to <body>,
   looks exactly like the card it came from. */
.market-overview { position: relative; isolation: isolate; display: flex; align-items: stretch; height: 64px; border: 1px solid var(--line); border-radius: var(--v2-radius, 12px); background: var(--panel); overflow: hidden; }
.overview-viewport { position: relative; display: flex; flex: 1 1 auto; min-width: 0; }
/* Positioned so a card's offsetLeft is its place in the scrolled content. */
.overview-track { position: relative; display: flex; flex: 1 1 auto; min-width: 0; padding: 0 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 36px; overscroll-behavior-x: contain; }
.overview-track::-webkit-scrollbar { display: none; }
.overview-track:empty::before { content: "Pin an asset to keep it in view"; align-self: center; padding: 0 12px; color: var(--subtle); font-size: 13px; white-space: nowrap; }

/* ---------- Edges: a fade and an arrow only where cards are hidden ---------- */
.overview-viewport::before, .overview-viewport::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 2; width: 52px; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.overview-viewport::before { left: 0; background: linear-gradient(90deg, var(--panel) 30%, transparent); }
.overview-viewport::after { right: 0; background: linear-gradient(270deg, var(--panel) 30%, transparent); }
.overview-viewport.overview-more-prev::before, .overview-viewport.overview-more-next::after { opacity: 1; }
.overview-scroll { position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 28px; height: 28px; margin-top: -14px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-3); color: var(--muted); box-shadow: 0 2px 10px #0000004d; cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.overview-scroll[hidden] { display: none; }
.overview-scroll-prev { left: 6px; }
.overview-scroll-next { right: 6px; }
.overview-scroll::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; transform: translateX(1.5px) rotate(45deg); }
.overview-scroll-next::before { transform: translateX(-1.5px) rotate(-135deg); }
.overview-scroll:hover { color: var(--text); border-color: var(--subtle); }

/* ---------- Cards ---------- */
.overview-custom { position: relative; display: flex; flex: none; padding: 6px 2px; scroll-snap-align: start; }
.overview-custom + .overview-custom::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--line); }
.overview-item { display: grid; grid-template-columns: auto 1fr; align-content: center; align-items: baseline; gap: 4px 6px; flex: 1 1 auto; padding: 0 10px; border-radius: 8px; background: transparent; color: var(--muted); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y; transition: background-color .15s ease; }
.overview-item:active { background: var(--panel-2); }
/* The end of the name row is kept free: that corner is where the remove button appears. */
.overview-name { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; min-width: 0; padding-right: 10px; font-size: 12px; font-weight: 500; line-height: 18px; }
.overview-logo { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--panel-3); color: var(--text); font-size: 12px; font-weight: 600; line-height: 1; overflow: hidden; }
.overview-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Wide enough for the longest default name; longer custom names are cut and stay whole in the tooltip. */
.overview-label { max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.overview-proxy { flex: none; color: var(--subtle); font-size: 12px; font-weight: 500; }
/* The hidden second row holds the widest form of this quote (data-reserve), so
   a tick that adds or drops a decimal never changes the card's width. */
.overview-price { display: inline-grid; color: var(--text); font-size: 13px; font-weight: 600; line-height: 18px; }
.overview-price::after { content: attr(data-reserve); height: 0; overflow: hidden; visibility: hidden; }
.overview-item strong { min-width: 6.5ch; font-size: 12px; font-weight: 600; line-height: 18px; }
.overview-item.positive strong { color: var(--green); }
.overview-item.negative strong { color: var(--red); }

/* Remove: on hover or keyboard focus with a pointer, behind Edit on touch. */
.overview-remove { position: absolute; top: 4px; right: 2px; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-3); color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .12s ease, color .12s ease, border-color .12s ease; }
.overview-custom:hover .overview-remove, .overview-custom:focus-within .overview-remove { opacity: 1; pointer-events: auto; }
.overview-remove:hover { color: var(--text); border-color: var(--subtle); }

/* ---------- Tools pinned at the right end ---------- */
.overview-add, .overview-edit, .mobile-overview-edit { flex: none; margin: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.overview-add { position: relative; width: 44px; padding: 0; }
.overview-add::before, .overview-add::after { content: ""; position: absolute; left: 50%; top: 50%; width: 13px; height: 1.5px; margin: -.75px 0 0 -6.5px; border-radius: 1px; background: currentColor; }
.overview-add::after { transform: rotate(90deg); }
.overview-edit, .market-overview .mobile-overview-edit { align-items: center; justify-content: center; padding: 0 14px; font-size: 13px; font-weight: 500; line-height: 1; }
.overview-edit { display: none; }
.overview-edit[aria-pressed="true"] { background: var(--panel-3); color: var(--accent); }
/* mobile.js groups "+" with its own Edit, which opens the reorder and remove sheet. */
.mobile-overview-tools { display: flex; flex: none; border-left: 1px solid var(--line); }
.mobile-overview-tools .overview-add { border-left: 0; }
.market-overview .mobile-overview-edit { display: flex; order: -1; border-left: 0; border-right: 1px solid var(--line); }
.shared-page .market-overview .overview-edit, .shared-page .market-overview .mobile-overview-tools { display: none; }

/* Drawn inside: the strip clips its overflow. The id outranks the theme-wide focus ring offset. */
#market-overview :focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (hover: hover) {
  .overview-item:hover { background: var(--panel-2); }
  .overview-add:hover, .overview-edit:hover, .market-overview .mobile-overview-edit:hover { background: var(--panel-2); color: var(--text); }
}
@media (hover: none) {
  .overview-custom .overview-remove { display: none; }
  .overview-name { padding-right: 0; }
  .overview-editing .overview-custom .overview-remove { display: grid; width: 24px; height: 24px; opacity: 1; pointer-events: auto; }
  /* Editing is an explicit mode: make room so the remove button never covers a name. */
  .overview-editing .overview-name { padding-right: 22px; }
  .market-overview > .overview-edit { display: inline-flex; }
}
/* Same condition as mobile.js: there its Edit sheet replaces the inline toggle. */
@media (max-width: 700px), (pointer: coarse) and (max-width: 1000px) and (max-height: 600px) {
  .market-overview > .overview-edit { display: none; }
}
@media (max-width: 700px) {
  .market-overview { height: 68px; }
  .overview-custom { min-width: 150px; }
  /* Keeps the text of a card that ends at the edge clear of the chevron drawn there. */
  .overview-item { padding: 0 12px; }
  .overview-viewport::before, .overview-viewport::after { width: 32px; }
  .mobile-overview-tools { flex-direction: column; width: 46px; }
  .mobile-overview-tools .overview-add { flex: 1 1 0; width: auto; }
  .market-overview .mobile-overview-edit { flex: 1 1 0; order: 0; padding: 0; border-right: 0; border-top: 1px solid var(--line); font-size: 12px; }
}
/* A finger swipes the strip, so the arrows shrink to bare chevrons in the card
   padding at each edge. They stay because two 150px cards fill a phone's row
   exactly, and a fade over an empty card end shows nothing: without a mark the
   strip would look complete. The snap inset still equals the track padding, or
   the first card would rest 4px in. */
@media (hover: none) and (pointer: coarse) {
  .overview-scroll { top: 0; width: 24px; height: 100%; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .overview-scroll-prev { left: 0; }
  .overview-scroll-next { right: 0; }
  .overview-track { scroll-padding-inline: 4px; }
  .overview-viewport::before { width: 18px; }
  .overview-viewport::after { width: 32px; }
}

/* ---------- Reordering by drag ---------- */
.overview-custom.overview-dragging { opacity: .3; }
.overview-custom.overview-drop-target::after { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.overview-custom.overview-drop-target.overview-drop-after::after { left: auto; right: -2px; }
.overview-drag-active .overview-track { scroll-snap-type: none; }
.overview-drag-active, .overview-drag-active * { cursor: grabbing !important; user-select: none; }
.overview-drag-preview { position: fixed; z-index: 10000; margin: 0; padding: 0; border: 1px solid var(--accent); border-radius: 10px; background: var(--panel-2); box-shadow: 0 14px 35px #00000099; opacity: .92; pointer-events: none !important; transition: none; }
.overview-drag-preview * { pointer-events: none !important; }
.overview-drag-preview::before, .overview-drag-preview .overview-remove { display: none; }
