.watchlist-resizable :is(#watchlist-columns, #pins) {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.watchlist-resizable #watchlist-columns { overflow: hidden; }

.watchlist-resizable :is(#watchlist-columns, #pins > .pin) {
  grid-template-columns: var(--watchlist-column-widths, var(--watch-columns, minmax(64px, 1.6fr) repeat(3, minmax(0, 1fr))));
  padding-inline-end: 14px;
}
.watchlist-resizable #watchlist-columns {
  --watch-column-grip: 12px;
}
.watch-column-heading {
  position: relative;
  align-self: stretch;
  min-width: 0;
}
.watch-column-divider {
  position: absolute;
  z-index: 1;
  inset-block: 0;
  inset-inline-end: calc(-2px - var(--watch-column-grip) / 2);
  inline-size: var(--watch-column-grip);
  display: grid;
  place-items: center;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}
.watch-column-divider::before {
  content: '';
  inline-size: 1px;
  block-size: 14px;
  background: var(--line);
  pointer-events: none;
}
.watch-column-divider:is(:hover, :focus-visible, [data-dragging])::before {
  inline-size: 2px;
  background: var(--accent);
}

.watch-column-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  inline-size: 100%;
  block-size: 100%;
  min-height: 27px;
  padding: 0;
  white-space: nowrap;
}
.watch-column-sort > span { overflow: hidden; text-overflow: ellipsis; }
.watch-column-heading:first-child .watch-column-sort { justify-content: flex-start; }
.watch-column-sort[data-direction] { color: var(--accent); }
.watch-column-sort[data-direction]::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1.5px 0 0 1.5px;
  transform: translateY(1px) rotate(45deg);
}
.watch-column-heading:first-child .watch-column-sort::before { order: 1; }
.watch-column-sort[data-direction=descending]::before { transform: translateY(-1px) rotate(225deg); }
#watchlist-sort-reset { width: 28px; margin-inline-start: auto; padding: 0; }
#watchlist-sort-reset svg { width: 15px; height: 15px; }
#watchlist-sort-reset:not([hidden]) + #markets { margin-inline-start: 0; }

.watchlist-panel #pins > .pin[hidden] { display: none; }
.watch-section {
  display: flex;
  align-items: stretch;
  min-height: 30px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.watch-section button { border-radius: 0; }
.watch-section-toggle {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  text-align: start;
  font-size: 12px;
  font-weight: 600;
}
.watch-section-toggle::before {
  content: '';
  flex: none;
  width: 5px;
  height: 5px;
  margin-inline-end: 2px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-1px) rotate(45deg);
}
.watch-section-toggle[aria-expanded=false]::before { transform: rotate(-45deg); }
.watch-section-toggle > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-section-toggle > small { margin-inline-start: auto; color: var(--muted); }
.watch-section-action { flex: none; width: 30px; padding: 0; font-size: 16px; }
.watch-section button:focus-visible { outline-offset: -2px; }
.watch-section-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.watch-section-form label { grid-column: 1 / -1; }
.watch-section-form input { display: block; width: 100%; margin-top: 4px; }
.watch-section-form button { border: 1px solid var(--line); min-height: 28px; }
.watch-section-home {
  padding: 7px 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}
#pins > [data-watch-drop=section] { outline: 2px solid var(--accent); outline-offset: -2px; }
#pins > [data-watch-drop=before] { box-shadow: inset 0 2px var(--accent); }
#pins > [data-watch-drop=after] { box-shadow: inset 0 -2px var(--accent); }

.watchlist-editor [hidden] { display: none; }
.watchlist-editor .filters > select { max-width: 100%; }
.watchlist-editor button[aria-pressed=true] { color: var(--accent); background: var(--soft); font-weight: 600; }
.watchlist-bulk { margin-block-end: 12px; font-size: 13px; }
.watchlist-selection-count { display: block; color: var(--muted); overflow-wrap: anywhere; }
.watchlist-bulk-actions, .watchlist-bulk-action { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.watchlist-bulk-actions.filters { margin-block: 6px 0; }
.watchlist-bulk-action { max-width: 100%; }
.watchlist-bulk-action select { max-width: min(100%, 210px); }
.watchlist-row-select { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

@media (any-pointer: coarse) {
  .watchlist-resizable #watchlist-columns { --watch-column-grip: 24px; min-height: 35px; }
  .watch-section { min-height: 40px; }
  .watch-section-action { width: 40px; }
  .watchlist-row-select { width: 24px; height: 24px; }
}

.watchlist-divider { display: none; }
@media (min-width: 851px) {
  #side.watchlist-resizable {
    --watchlist-height-grip: 14px;
    --watchlist-width-grip: 14px;
    position: relative;
    grid-template-rows: minmax(0, var(--watchlist-height, 1fr)) var(--watchlist-height-grip) minmax(0, 1fr);
    gap: 0;
  }
  .watchlist-divider {
    display: grid;
    place-items: center;
    touch-action: none;
    user-select: none;
  }
  .watchlist-divider[data-axis=width] {
    position: absolute;
    z-index: 4;
    inset-block: 0;
    inset-inline-start: calc(-1px - var(--watchlist-width-grip) / 2);
    width: var(--watchlist-width-grip);
    cursor: col-resize;
  }
  .watchlist-divider[data-axis=height] { cursor: row-resize; }
  .watchlist-divider::before {
    content: '';
    border-radius: 2px;
    background: var(--muted);
    pointer-events: none;
  }
  .watchlist-divider[data-axis=width]::before { width: 2px; height: 24px; }
  .watchlist-divider[data-axis=height]::before { width: 24px; height: 2px; }
  .watchlist-divider:is(:hover, :focus-visible, [data-dragging])::before { background: var(--accent); }
  .watchlist-divider:focus-visible { outline-offset: -2px; }
}
@media (min-width: 851px) and (any-pointer: coarse) {
  #side.watchlist-resizable { --watchlist-height-grip: 24px; --watchlist-width-grip: 24px; }
}
@media (forced-colors: active) {
  :is(.watchlist-divider, .watch-column-divider)::before { background: ButtonText; forced-color-adjust: none; }
  :is(.watchlist-divider, .watch-column-divider):is(:hover, :focus-visible, [data-dragging])::before { background: Highlight; }
}
