/* ── 30-racks.css — Storage / rack inventory view + drag-drop + unranked panel ── */
  /* ═══════════════════════════════════════════════════════════════════
     Racks (storage) — main inventory view mode
     ═══════════════════════════════════════════════════════════════════ */
  .inv-rack-view {
    display: flex; flex-direction: column; gap: 14px;
    padding: 0 0 4px;
    margin-top: var(--view-gap);
    /* Take remaining height inside #card-inv (overflow:hidden flex:column). The
       view itself does NOT scroll — the header stays put, the racks area scrolls
       on its own, and the docked panel stays full-height beside it. */
    flex: 1; min-height: 0;
    overflow: hidden;
  }
  .inv-rack-view.hidden { display: none; }
  .rv-header { display: flex; gap: 8px; }
  /* Slot-content view switch (colour fill ↔ material photo) — segmented control
     reusing .view-toggle, kept compact + vertically centred beside the stats. */
  .rv-slotview-toggle { flex-shrink: 0; align-self: center; }
  .rv-slotview-toggle button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .rv-slotview-toggle .icon { background: var(--muted); }
  .rv-slotview-toggle button.active .icon { background: var(--text); }
  .rp-actions { display: flex; gap: 8px; flex-shrink: 0; }
  .rp-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 14px;
    background: var(--primary); border: 1px solid var(--primary); color: var(--on-accent);
    border-radius: 10px; font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  .rp-cta:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
  .rp-cta .icon { background: var(--on-accent); }

  .rp-list {
    flex: 1; min-height: 0;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
    padding-right: 2px;
  }
  .rp-list::-webkit-scrollbar { width: 4px; }
  .rp-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* Single rack card — sized to its content (slot count drives width). */
  .rp-rack {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
    width: fit-content;
    min-width: 220px;          /* room for the head row even with very narrow racks */
    flex: 0 0 auto;
  }
  .rp-rack-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  .rp-rack-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  /* Inline counter — name + "·" + filled/total, all on the same line. The
     counter dims to muted color so the rack name remains the dominant element. */
  .rp-rack-name {
    font-size: 14px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: baseline; gap: 6px;
  }
  .rp-rack-name-text { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .rp-rack-count { color: var(--muted); font-weight: 400; flex-shrink: 0; }
  .rp-rack-count-num { color: var(--muted); font-weight: 600; font-family: var(--mono); font-size: 12.5px; flex-shrink: 0; }
  /* Optional subtitle line under the rack name — a single line isn't enough to
     say everything; muted, ellipsised so it never breaks the header height. */
  .rp-rack-subtitle {
    font-size: 11.5px; font-weight: 500; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  }
  /* Legacy meta line — kept for any other callers, but rack head no longer uses it */
  .rp-rack-meta { font-size: 11px; color: var(--muted); }
  .rp-rack-actions { display: flex; gap: 4px; flex-shrink: 0; position: relative; }
  .rp-rack { position: relative; }

  /* "+ Rack" tile shown after the existing rack cards. Sits in the same flex
     row, hugs its content width, dashed border to look like a placeholder. */
  .rp-rack-add {
    /* Sized by JS masonry — pick a sensible default width so the tile reads
       as a "create new rack" affordance, not a tiny button */
    width: 220px;
    min-height: 120px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 6px;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: 14px;
    color: var(--muted);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s, transform .12s;
  }
  .rp-rack-add:hover {
    border-color: var(--primary);
    color: var(--primary-text);
    background: var(--primary-soft);
    transform: translateY(-1px);
  }
  .rp-rack-add-plus {
    font-size: 32px; font-weight: 300; line-height: 1;
  }
  .rp-rack-add-label {
    font-size: 13px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
  }
  .rp-rack-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none; border-radius: 8px;
    cursor: pointer; transition: background .15s;
  }
  .rp-rack-btn:hover { background: var(--border); }
  .rp-rack-btn .icon { background: var(--muted); }
  .rp-rack-btn:hover .icon { background: var(--text); }
  .rp-rack-btn--danger:hover { background: var(--danger-soft); }
  .rp-rack-btn--danger:hover .icon { background: var(--danger); }

  /* Head buttons — fade in on rack hover, fully visible when a menu is open or
     when the rack is keyboard-focused. Reduces visual noise at rest. */
  .rp-rack-kebab,
  .rp-rack-move {
    opacity: 0;
    transition: opacity .15s, background .15s;
  }
  .rp-rack:hover .rp-rack-kebab,
  .rp-rack:hover .rp-rack-move,
  .rp-rack-kebab:focus-visible,
  .rp-rack-move:focus-visible,
  .rp-rack-kebab[aria-expanded="true"] {
    opacity: 1;
  }
  /* The one control whose press is a drag rather than a click — so it says so,
     and it is the only thing on a resting card that offers to be grabbed. */
  .rp-rack-move { cursor: grab; }
  .rp-rack-kebab[aria-expanded="true"] {
    background: var(--border);
  }
  .rp-rack-kebab[aria-expanded="true"] .icon { background: var(--text); }
  /* Floating menu dropped from the kebab. Position is set inline by JS. */
  .rp-menu {
    position: fixed;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.10);
    padding: 4px;
    display: flex; flex-direction: column;
    z-index: 1000;
    /* Spring-in feel — quick scale + fade */
    animation: rp-menu-in .14s cubic-bezier(.25, .8, .35, 1.05);
    transform-origin: top right;
  }
  .rp-menu[hidden] { display: none; }
  @keyframes rp-menu-in {
    from { opacity: 0; transform: scale(.92) translateY(-4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  .rp-menu-item {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    background: transparent; border: none;
    border-radius: 6px;
    color: var(--text);
    font-family: inherit; font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .12s;
    overflow: hidden;   /* clip the hold-progress fill to the rounded corners */
  }
  .rp-menu-item:hover { background: var(--surface-2); }
  .rp-menu-item .icon { background: var(--muted); flex-shrink: 0; position: relative; z-index: 1; }
  .rp-menu-item:hover .icon { background: var(--text); }
  .rp-menu-item .rp-menu-label { flex: 1; min-width: 0; position: relative; z-index: 1; }
  /* Hold-to-confirm variant — fills with the progress bar while pressed.
     The fill itself is the affordance; no need for an extra label.
     Icon + label are centered as a group so the action reads as a "button"
     rather than a list item — emphasises that it's a deliberate action. */
  .rp-menu-item--hold {
    justify-content: center;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
  }
  .rp-menu-item--hold .rp-menu-label {
    flex: 0 0 auto;
  }
  .rp-menu-item--hold.is-holding { background: var(--surface-2); }
  .rp-menu-item--hold.is-confirming { background: var(--primary); color: var(--on-accent); }
  .rp-menu-item--hold.is-confirming .icon { background: var(--on-accent); }
  .rp-menu-item--hold.is-confirming.rp-menu-item--danger { background: var(--danger); }
  /* Make sure the hold-progress overlay sits above the bg but below the label */
  .rp-menu-item--hold .hold-progress { z-index: 0; opacity: .55; }

  .rp-menu-item--danger { color: var(--danger-text); }
  .rp-menu-item--danger .icon { background: var(--danger); }
  .rp-menu-item--danger:hover { background: var(--danger-soft); }
  .rp-menu-item--danger:hover .icon { background: var(--danger); }
  /* A heading inside a menu, for a group of switches. Quiet: it names a section,
     it is not something you can press. */
  .rp-menu-head {
    padding: 6px 12px 3px; font-size: 10px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  }
  /* A menu item that is a SWITCH, not an action: the label on the left, the
     switch on the right, the way a settings row reads everywhere else. A tick
     said "this happened"; a switch says "this is a thing you set", which is
     what these are. */
  .rp-menu-item--toggle { justify-content: space-between; gap: 14px; }
  .rp-menu-item--toggle .rp-menu-label { flex: 1; min-width: 0; }
  .rp-menu-switch {
    flex-shrink: 0; position: relative; width: 30px; height: 17px;
    border-radius: 999px; background: var(--surface-3);
    box-shadow: inset 0 0 0 1px var(--border);
    transition: background .15s, box-shadow .15s;
  }
  .rp-menu-switch::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 13px; height: 13px; border-radius: 50%;
    background: var(--muted);
    transition: transform .15s, background .15s;
  }
  .rp-menu-item--toggle.is-on .rp-menu-switch {
    background: var(--primary); box-shadow: inset 0 0 0 1px var(--primary);
  }
  .rp-menu-item--toggle.is-on .rp-menu-switch::after {
    transform: translateX(13px); background: #fff;
  }

  .rp-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
  }

  /* ── Stats bar (top of the Storage view) ──────────────────────────────── */
  .rv-stats {
    flex: 1;
    display: flex; align-items: stretch;
    gap: 8px;
    min-width: 0;
  }
  /* "+ New Rack" button — same dimensions as the data stat tiles so the
     stats bar stays visually uniform. Dashed border to read as a "create"
     affordance; the "+" plays the role of a number, the label is the unit.
     Inherits .rv-stat for size + structure, plus a button reset. */
  button.rv-stat-add {
    margin: 0;
    /* Match .rv-stat exactly: same padding so the inner content box has the
       same height. The 0.5px border delta (1.5 dashed vs 1 solid) is absorbed
       by box-sizing: border-box → outer height stays identical. */
    padding: 6px 12px;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    line-height: 1.2;
    -webkit-appearance: none; appearance: none;
    box-sizing: border-box;
    background: transparent;
    border: 1.5px dashed var(--border);
    flex-shrink: 0;
    transition: border-color .15s, background .15s, color .15s, transform .12s;
  }
  button.rv-stat-add::-moz-focus-inner { border: 0; padding: 0; }
  button.rv-stat-add:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-text);
    transform: translateY(-1px);
  }
  /* The "+" plays the role of a number — must occupy EXACTLY the same line
     box as a digit (.rv-stat-num is 18px / line-height 1.1), otherwise the
     tile would render taller than its neighbours and break the row alignment.
     Thinner weight makes the glyph read as a plus instead of a "1". */
  .rv-stat-num--plus {
    font-size: 18px;
    line-height: 1.1;
    font-weight: 300;
    font-family: inherit;
  }
  .rv-stat {
    display: flex; flex-direction: column; justify-content: center;
    min-width: 64px;
    padding: 6px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: background .15s, border-color .15s;
  }
  .rv-stat--wide { min-width: 160px; flex: 0 1 220px; }
  /* Slots tile — number and label on a single line, mini progress bar below */
  .rv-stat--slots .rv-stat-line {
    display: flex; align-items: baseline; gap: 6px;
    line-height: 1.1;
  }
  .rv-stat-lbl--inline {
    font-size: 11px;
    margin-top: 0;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 600;
  }
  .rv-stat--clickable { cursor: pointer; }
  .rv-stat--clickable:hover {
    background: var(--surface);
    border-color: var(--primary);
  }
  .rv-stat-num {
    font-size: 18px; font-weight: 700; color: var(--text);
    font-family: var(--mono);
    line-height: 1.1;
    display: flex; align-items: baseline; gap: 1px;
  }
  .rv-stat-num-strong { color: var(--text); }
  .rv-stat-num-sep    { color: var(--muted); font-weight: 400; opacity: .5; padding: 0 2px; }
  .rv-stat-num-soft   { color: var(--muted); font-weight: 500; }
  .rv-stat-lbl {
    font-size: 10.5px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    margin-top: 1px;
    white-space: nowrap;       /* keep "NOT STORED" / etc. on a single line */
    line-height: 1.2;
  }
  /* Mini progress bar for the slots cell — shows fill ratio at a glance */
  .rv-stat-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
  }
  .rv-stat-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width .3s cubic-bezier(.4, 0, .2, 1);
  }
  /* Active filter highlight — applied when a stat tile is "selected" to
     filter the rack view */
  .rv-stat--active {
    background: var(--primary-soft);
    border-color: var(--primary);
  }
  .rv-stat--active .rv-stat-lbl,
  .rv-stat--active .rv-stat-num { color: var(--primary-text); }

  /* Permanent orange tint for the "not stored" tile — distinguishes it from
     the neutral data tiles (racks/slots/empty/locked) since it represents
     spools that need attention. The element is a <div> (same as Locked) with
     role=button so its box model is identical to the other tiles.
     Layout switches to a row (body on the left, chevron on the right) to make
     room for an affordance hinting that clicking opens a side panel. */
  .rv-stat--orange {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-color: color-mix(in srgb, var(--primary) 45%, transparent);
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .rv-stat--orange .rv-stat-body {
    display: flex; flex-direction: column;
    flex: 1; min-width: 0;
  }
  /* Chevron always points RIGHT — purely an affordance hint that the tile
     opens a side panel. Color flips to white when the panel is open so it
     stays readable on the saturated orange background. */
  .rv-stat-chev {
    flex-shrink: 0;
    background: var(--primary);
    transition: background .15s;
  }
  .rv-stat--orange.rv-stat--active .rv-stat-chev {
    background: var(--surface);
  }
  .rv-stat--orange .rv-stat-num,
  .rv-stat--orange .rv-stat-lbl { color: var(--primary-text); }
  .rv-stat--orange:hover {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    border-color: var(--primary);
  }
  /* When the panel is open, intensify the orange so the toggle reads as ON */
  .rv-stat--orange.rv-stat--active {
    background: var(--primary);
    border-color: var(--primary);
  }
  .rv-stat--orange.rv-stat--active .rv-stat-num,
  .rv-stat--orange.rv-stat--active .rv-stat-lbl { color: var(--on-accent); }

  /* ── Drop-zone visibility while dragging a spool ──────────────────────── */
  /* Keep the rack NEUTRAL during a drag: no ambient orange flood on every empty
     slot — lighting up every empty slot at once made the whole card read as
     "illuminated". Only the slot directly under the cursor (.rp-slot--drop)
     highlights; locked slots just dim so they read as forbidden. */
  body.is-dragging-spool .rp-slot--locked {
    opacity: .35;
  }

  /* ── Bounce-in for newly placed slots ─────────────────────────────────── */
  /* Triggered by .rp-slot--just-placed — scale 0.6 → 1.08 → 1.0 with a soft
     overshoot. Stripped after ~400ms so it doesn't replay on next render. */
  @keyframes rp-slot-bounce-in {
    0%   { transform: scale(.6); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
  }
  .rp-slot--just-placed {
    animation: rp-slot-bounce-in .32s cubic-bezier(.34, 1.6, .64, 1) both;
  }

  /* ── Cascade-out for emptyRack (each slot flies toward the unranked panel) */
  /* The unranked panel sits to the right, so we slide right + fade as the
     spool "leaves" the rack. JS sets animationDelay per slot for the stagger. */
  @keyframes rp-slot-cascade-out {
    0%   { transform: translateX(0) scale(1); opacity: 1; }
    50%  { transform: translateX(20px) scale(.9); opacity: .6; }
    100% { transform: translateX(80px) scale(.4); opacity: 0; }
  }
  .rp-slot--cascade-out {
    animation: rp-slot-cascade-out .28s cubic-bezier(.4, 0, .8, .4) forwards;
    pointer-events: none;
  }

  /* ── Rich hover tooltip for filled rack slots ─────────────────────────
     Floating bubble showing brand / material / color / weight bar / UID
     for the spool under the cursor. Singleton element appended to <body>.
     Positioned above the slot by JS (or below if no room). */
  #rackHoverTip {
    position: fixed;
    z-index: 1000;
    min-width: 220px;
    max-width: 280px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.10);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .12s, transform .14s cubic-bezier(.34, 1.4, .64, 1);
  }
  #rackHoverTip.is-open {
    opacity: 1;
    transform: translateY(0);
  }
  #rackHoverTip .rht-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 8px;
  }
  /* ── Two-column row: optional material image on the left, content on the
     right. When there's no image, only `.rht-col` is present and the row
     collapses to a single column visually identical to the pre-image layout. */
  #rackHoverTip .rht-row {
    display: flex; gap: 10px; align-items: stretch;
  }
  #rackHoverTip .rht-col {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
  }
  /* Material thumbnail (TigerTag+ url_img) — left column, takes the full
     height of the tooltip card via `align-self: stretch`. Width is fixed at
     72 px (visually balanced against the typical right-column content);
     `object-fit: contain` keeps the full product shot visible regardless of
     its native aspect ratio. `min-height` prevents the image from collapsing
     when the right column is very short. */
  #rackHoverTip .rht-mat-img {
    width: 72px;
    align-self: stretch;
    min-height: 72px;
    flex-shrink: 0;
    border-radius: 8px;
    object-fit: contain;
    background: var(--ink-06);
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  }
  /* Mini puck preview — same proportion as the rack slots */
  #rackHoverTip .rht-puck {
    width: 22px;
    aspect-ratio: 3 / 5;
    flex-shrink: 0;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.12);
    background: color-mix(in srgb, var(--neutral) 12%, transparent);
    position: relative; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }
  #rackHoverTip .rht-puck-fill {
    position: absolute; bottom: 0; left: 0; right: 0;
    background-size: cover; background-position: center;
  }
  #rackHoverTip .rht-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  #rackHoverTip .rht-brand {
    font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #rackHoverTip .rht-mat {
    color: var(--muted); font-size: 11.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #rackHoverTip .rht-coord {
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 11px; font-weight: 700;
    color: var(--primary-text);
    background: var(--primary-soft);
    border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
    padding: 2px 6px;
    border-radius: 5px;
  }
  #rackHoverTip .rht-weight { margin: 6px 0; }
  #rackHoverTip .rht-weight-line {
    display: flex; align-items: baseline; gap: 4px;
    font-family: var(--mono); font-size: 11.5px;
    margin-bottom: 4px;
  }
  #rackHoverTip .rht-weight-cur { font-weight: 700; color: var(--text); }
  #rackHoverTip .rht-weight-sep { color: var(--muted); opacity: .5; }
  #rackHoverTip .rht-weight-cap { color: var(--muted); }
  #rackHoverTip .rht-weight-pct {
    margin-left: auto;
    font-weight: 600;
    color: var(--primary-text);
  }
  #rackHoverTip .rht-weight-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
  }
  #rackHoverTip .rht-weight-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
  }
  #rackHoverTip .rht-meta {
    display: flex; align-items: center; gap: 8px;
    margin-top: 6px; padding-top: 6px;
    border-top: 1px solid var(--border);
    font-family: var(--mono); font-size: 10.5px;
  }
  #rackHoverTip .rht-meta-k { color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
  #rackHoverTip .rht-meta-v { color: var(--text); }
  #rackHoverTip .rht-locked {
    display: flex; align-items: center; gap: 6px;
    margin-top: 6px;
    color: rgb(217, 119, 6);
    font-size: 11px;
  }
  #rackHoverTip .rht-locked .icon { background: rgb(217, 119, 6); }
  :root:not([data-theme="dark"]) #rackHoverTip .rht-locked { color: var(--warning-text); }
  :root:not([data-theme="dark"]) #rackHoverTip .rht-locked .icon { background: var(--warning-text); }

  /* ── Stat-bar highlight: glow ring around matching slots when a stat tile
     ("empty" / "locked") is selected. Self-fading pulse so it draws the eye
     without becoming permanently distracting. */
  @keyframes rp-slot-highlight-pulse {
    0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent), 0 0 8px color-mix(in srgb, var(--primary) 50%, transparent); }
    50%      { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 85%, transparent), 0 0 14px color-mix(in srgb, var(--primary) 85%, transparent); }
  }
  .rp-slot--highlight {
    animation: rp-slot-highlight-pulse 1.6s ease-in-out infinite;
    z-index: 2;
  }

  /* Grid */
  .rp-grid { display: flex; flex-direction: column; gap: 6px; }
  .rp-row {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);   /* shelf line */
  }
  .rp-row:last-child { padding-bottom: 0; border-bottom: none; }
  /* Coordinate labels (shelf letter A,B,C / slot number 1,2,3) — hidden by
     default to reduce visual noise, revealed contextually:
       - on rack hover (so the user can find a coord by mousing over the rack)
       - while a spool is being dragged (so the user can aim precisely)
     Tooltips on each slot still expose [B3] etc. on hover individually. */
  .rp-row-label {
    width: 18px; flex-shrink: 0; text-align: right;
    font-size: 11px; font-weight: 700; color: var(--muted); font-family: var(--mono);
    opacity: 0;
    text-transform: uppercase;
    transition: opacity .18s;
  }
  /* Column number header — sits above the first shelf, no border, no padding.
     Height is reserved permanently (was height: 0 / 14px on hover): the height
     transition forced a reflow of every slot on rack-hover, which re-rasterized
     the compositor layers of `.rp-slot--match` slots (transform: scale animation)
     and produced a visible flash when sweeping between racks that both contained
     matches. Reveal is now opacity-only on `.rp-col-label` (compositor-only). */
  .rp-row--header {
    padding-bottom: 4px;
    border-bottom: none;
    height: 14px;
    overflow: hidden;
    padding-top: 0;
    margin-bottom: 0;
  }
  .rp-row--header .rp-col-label {
    font-size: 10px; font-weight: 700; color: var(--muted);
    font-family: var(--mono);
    text-align: center;
    opacity: 0;
    line-height: 1;
    transition: opacity .18s;
  }
  /* Reveal coordinates: rack hover OR while dragging a spool anywhere */
  .rp-rack:hover .rp-row-label,
  body.is-dragging-spool .rp-row-label {
    opacity: .65;
  }
  .rp-rack:hover .rp-row--header .rp-col-label,
  body.is-dragging-spool .rp-row--header .rp-col-label {
    opacity: .55;
  }
  .rp-row-slots {
    flex: 1; display: grid;
    /* Fixed-width tracks → slots stay small and box-like even on wide columns.
       The number of tracks is driven by --slots set inline per row. */
    grid-template-columns: repeat(var(--slots, 8), 32px);
    gap: 4px;
    justify-content: start;
  }
  .rp-slot {
    /* Vertical rectangle — simulates a filament spool box seen from the front
       (boxes are ~60% as wide as they are tall, see physical-rack reference). */
    aspect-ratio: 3 / 5;
    border: 1.5px dashed var(--border);
    border-radius: 5px;
    background: var(--surface);
    position: relative;
    overflow: hidden;
    transition: border-color .15s, background .15s;
  }
  .rp-slot:hover { border-color: var(--primary); background: var(--primary-soft); }
  /* Inner fill = the actual spool color (mono / gradient / conic) at the
     correct height matching remaining-weight %. Slot stays the "container". */
  .rp-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background-size: cover;
    background-position: center;
    transition: height .35s cubic-bezier(.4,0,.2,1);
  }
  /* Photo view — a full solid colour tile (no weight bar) with the material
     illustration layered on top when present. */
  .rp-fill--full { top: 0; height: 100%; }
  /* Inset, not full-bleed — the full colour tile behind shows round the photo
     as a frame in the spool's own colour, as on the grid cards. */
  .rp-slot .rp-photo {
    position: absolute; top: 7%; left: 7%;
    width: 86%; height: 86%;
    object-fit: cover; display: block;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  }
  /* Picture view: filled tiles get a solid frame + slight elevation so even a
     WHITE material reads as an occupied tile — empty slots keep their flat dashed
     outline (same "filled vs empty" affordance as the colour view). Purely
     aesthetic → no hover reaction (keep the resting frame, no lift). */
  .rp-slotview-photo .rp-slot--filled,
  .rp-slotview-photo .rp-slot--filled:hover {
    border-color: var(--border);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.16);
    transform: none;
  }
  /* Square tiles in picture view — the illustrations are square, so a 1:1 slot
     shows them uncropped (vs the 3:5 "spool box" of the colour view). Bigger
     tracks too (like the unranked side cards) for a roomy, gallery-like grid. */
  .rp-slotview-photo .rp-slot { aspect-ratio: 1 / 1; }
  .rp-slotview-photo .rp-row-slots { grid-template-columns: repeat(var(--slots, 8), 64px); gap: 6px; }

  /* ═══════════════════════════════════════════════════════════════════
     Shelf depth — several spools one behind the other
     ═══════════════════════════════════════════════════════════════════
     A deep shelf draws the SAME grid once per depth, each one pushed up and
     sideways so the row behind stays readable. Depth 0 is the front row: the
     one you can reach, so it is on top and it is the one that carries the
     weight bar.

     The two offsets are a USER SETTING (`tigertag.rack.depthOffset`, written
     onto #invRackView by the renderer), because how much of the row behind you
     want to see is a matter of taste — and of how tall your racks may get.
     `--rk-zscale` exists because picture view draws 64 px tiles against the
     colour view's 32 px ones: an offset that reveals two thirds of a spool in
     one mode would reveal a third in the other. Scaling by the tile size keeps
     ONE setting honest in both. */
  #invRackView { --rk-zy: 34px; --rk-zx: 14px; --rk-zscale: 1; }
  /* `rp-slotview-photo` lands on #invRackView ITSELF, so a bare class selector
     loses to the id rule above and the scale silently stayed at 1 — which left
     the back rows only a ~20 px sliver of the 64 px picture tiles, too small to
     see or to drop onto. The compound selector is what makes it win. */
  #invRackView.rp-slotview-photo, #invRackView .rp-slotview-photo { --rk-zscale: 2; }

  /* Resolved on the rack, not on `.rp-persp`: the row needs the same numbers to
     reserve its top padding, and a custom property only travels DOWN the tree —
     defining them on the plane holder left `.rp-row` reading the raw fallback
     and ignoring the picture-view scale entirely. */
  .rp-rack--deep {
    --zy: calc(var(--rk-zy, 34px) * var(--rk-zscale, 1));
    --zx: calc(var(--rk-zx, 14px) * var(--rk-zscale, 1));
    /* The overhang is reserved on whichever side the planes lean towards — the
       horizontal offset is signed, so it can be either one. Without this the
       back rows spill outside the rack card and the masonry packs them wrong. */
    --zres-r: calc((var(--depth, 1) - 1) * max(0px, var(--zx)));
    --zres-l: calc((var(--depth, 1) - 1) * max(0px, calc(-1 * var(--zx))));
  }
  .rp-persp {
    position: relative;
    flex: 1;
    /* Each shelf keeps its planes to itself: without this, the front row of the
       shelf above (z-index 3) paints over the back row of the shelf below. */
    isolation: isolate;
    padding-left: var(--zres-l);
    padding-right: var(--zres-r);
  }
  .rp-persp .rp-plane {
    position: absolute; top: 0; left: var(--zres-l);
    transform-origin: left bottom;
  }
  /* Front row: in flow, so it is what gives the holder its size. */
  .rp-persp .rp-plane[data-depth="0"] { position: relative; left: 0; z-index: 3; }
  /* Offset only — NEVER scaled and never faded. A slot is a slot: it holds the
     same spool whatever row it sits in, so it is drawn at the same size and the
     same opacity as the front row. Shrinking the back rows made them read as
     lesser, half-real slots, and made them smaller targets for no reason. */
  /* One rule for every plane, driven by the `--d` index the renderer writes.
     Enumerating depths by hand meant a shelf deeper than the last rule listed
     drew its far row flat on top of the others, with no offset and no shadow —
     and silently, since nothing fails when a selector simply doesn't match. */
  .rp-persp .rp-plane {
    /* Declared here with its default so the value has a home in the stylesheet;
       the renderer's inline `--plane` overrides it, inline winning over a rule. */
    --plane: 0;
    transform: translate(calc(var(--zx) * var(--plane)), calc(-1 * var(--zy) * var(--plane)));
    /* Same ladder the enumerated rules used — front row 3, then 2, 1, 0 — because
       the shelf ABOVE relies on it: at z-index 3 it must paint over the back row
       of the shelf below (see the note above). A different scale would have
       broken that quietly. `--plane` is the row's index; `--depth`, set on the
       rack, is how many rows it has. Two different numbers, deliberately not
       sharing a name. */
    z-index: calc(3 - var(--plane));
  }
  .rp-persp .rp-plane { opacity: 1; }
  /* Leaning left: shrink towards the right edge instead, or the planes drift. */
  #invRackView.rk-zx-neg .rp-persp .rp-plane { transform-origin: right bottom; }
  /* Cast shadow so a row reads as standing in FRONT of the one behind it. Only
     a drop shadow — the inset white ring the base slot uses lightened the tile
     and made a back row look washed out, as if it were see-through. */
  .rp-persp .rp-plane .rp-slot--filled {
    box-shadow: -3px 4px 9px rgba(0,0,0,.28);
  }
  /* The colour tile of a back row covers its slot completely: no wash of the
     slot's own background shows through, so the filament colour reads true. */
  .rp-persp .rp-plane:not([data-depth="0"]) .rp-slot--filled { background: var(--surface); }
  .rp-persp .rp-plane:not([data-depth="0"]) .rp-fill--full { top: 0; bottom: 0; height: 100%; }
  /* A free spot on a back row is drawn exactly like one on the front row: a
     shelf position reads the same wherever it sits in the depth — only the
     offset says how far back it is. It is a drop target like any other. */
  /* The column-number line is a `.rp-row` too, but it has no back rows to make
     room for — giving it the depth padding added a band of empty space under the
     rack name that grew with every extra row of depth. Shelves only. */
  .rp-rack--deep .rp-row:not(.rp-row--header) {
    align-items: flex-end;
    /* Exactly the offset the back rows need, not a pixel more: the top-most slot
       then starts at the same height whatever the depth, instead of sinking a
       little further under the rack name with every row added. */
    padding-top: calc((var(--depth, 1) - 1) * var(--zy));
  }
  /* The search / colour highlight has to beat the plane shadows above. */
  .rp-persp .rp-plane .rp-slot--filled.rp-slot--match {
    box-shadow: 0 0 0 2px var(--primary), 0 4px 14px rgba(0,0,0,.45);
  }

  /* ═══════════════════════════════════════════════════════════════════
     The plan — racks placed by hand
     ═══════════════════════════════════════════════════════════════════ */
  .rv-plan-btn, .rv-plan-auto {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 10px; flex-shrink: 0; align-self: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    border-radius: 9px; font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  }
  .rv-plan-btn:hover, .rv-plan-auto:hover { background: var(--surface-hover); color: var(--text); }
  .rv-plan-btn.on { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
  .rv-plan-btn .icon { background: currentColor; }

  /* The grid only exists while editing: the rest of the time it is chrome that
     says nothing. Minor lines are the 24 px snap step, major ones every fifth,
     so distances stay readable instead of turning into graph paper. It sits on
     the scrolling content, not the frame, or it would slide out of step with
     the racks the moment you scroll. */
  /* The header is the handle when not arranging — grabbing anywhere else would
     fight the spools, which are the point of the card. */
  #invRackView:not(.is-read-only) .rp-rack-head { cursor: grab; }
  #invRackView .rp-rack.is-plan-dragging .rp-rack-head { cursor: grabbing; }

  /* The grid is painted on the SCROLL AREA, not on the column inside it.

     The column is the element that gets scaled, and its own box is measured in
     already-scaled units — so a background on it came out at the zoom squared
     and covered a fraction of the board. On the scroller the grid is drawn once,
     at true screen size, and `background-attachment: local` makes it travel with
     the content so it stays lined up with the racks while panning.

     `--plan-z` carries the zoom so the mesh keeps matching the 24 px snap step
     at any scale. */
  #invRackView.is-plan-edit .rp-racks-scroll,
  #invRackView.is-plan-moving .rp-racks-scroll {
    background-attachment: local;
    background-image:
      linear-gradient(var(--grid-major) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size:
      calc(120px * var(--plan-z, 1)) calc(120px * var(--plan-z, 1)),
      calc(120px * var(--plan-z, 1)) calc(120px * var(--plan-z, 1)),
      calc(24px * var(--plan-z, 1))  calc(24px * var(--plan-z, 1)),
      calc(24px * var(--plan-z, 1))  calc(24px * var(--plan-z, 1));
  }
  /* Zoomed well out the 24 px mesh would be a few pixels wide — graph paper, not
     a guide. Only the major lines survive down there. */
  #invRackView.is-plan-coarse.is-plan-edit .rp-racks-scroll,
  #invRackView.is-plan-coarse.is-plan-moving .rp-racks-scroll {
    background-image:
      linear-gradient(var(--grid-major) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
    background-size:
      calc(120px * var(--plan-z, 1)) calc(120px * var(--plan-z, 1)),
      calc(120px * var(--plan-z, 1)) calc(120px * var(--plan-z, 1));
  }
  #invRackView.is-plan-edit .rp-rack {
    cursor: grab;
    outline: 2px solid transparent; outline-offset: 3px;
    transition: outline-color .15s, box-shadow .15s;
  }
  #invRackView.is-plan-edit .rp-rack:hover { outline-color: var(--border-strong); }
  /* Picked up, in the drawing-program sense — and NOT tied to Arrange: a
     selection you cannot see is a selection that will surprise you the moment
     you drag something. */
  #invRackView .rp-rack.is-plan-selected {
    outline: 2px solid var(--primary); outline-offset: 3px;
  }
  /* The lift is set inline by the drag handler — the layout writes an inline
     z-index on every card, and no stylesheet rule can outrank that. */
  #invRackView .rp-rack.is-plan-dragging {
    cursor: grabbing; box-shadow: 0 20px 44px rgba(0,0,0,.32);
    /* HELD. A shadow alone is not a sign on a card that has barely moved — the
       collision rule below still outranks this, so a bad landing stays red. */
    outline: 2px solid var(--primary); outline-offset: 3px;
  }
  /* Nothing is ever refused and nothing else moves, so a card in motion is never
     an error state — it just glides. */
  /* Only the highlight animates. Position is never animated: nothing moves a
     rack but the user's own hand, so an animated left/top can only ever be a
     re-layout being drawn — which is exactly what made the plan flash through a
     wrong arrangement on every notch of the wheel. */
  #invRackView.is-plan-edit .rp-rack { transition: outline-color .15s, box-shadow .15s; }
  #invRackView .rp-rack.is-plan-dragging { transition: none; }
  /* While arranging the furniture, the contents are not the subject: swallowing
     the pointer stops a drag from grabbing a spool instead of the rack. */
  #invRackView.is-plan-edit .rp-grid,
  #invRackView.is-plan-edit .rp-rack-head { pointer-events: none; }

  /* Height is declared on the wrapper, not left to whatever is inside it: the
     control has to line up with the buttons either side of it, and a child that
     inherits an unexpected size from a global rule must not be able to push it
     out of line. */
  .rv-plan-zoom {
    display: inline-flex; align-items: center; gap: 2px; align-self: center; flex-shrink: 0;
    height: 32px; padding: 0 3px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  }
  .rv-plan-zoom button {
    width: 24px; height: 24px; border: 0; border-radius: 6px; cursor: pointer;
    background: transparent; color: var(--muted); font-family: inherit; font-size: 15px; line-height: 1;
  }
  .rv-plan-zoom button:hover { background: var(--surface-hover); color: var(--text); }
  /* Doubled class on purpose: the global `input[type="number"]` rule in
     60-modals.css is (0,1,1) — the same weight as a two-class selector — so a
     plain `.rv-plan-zoom .val` only tied with it and lost on load order, which
     handed this field a 40 px height and a full border. See the CSS note in
     CLAUDE.md; the underlying fix is to make those global rules weightless. */
  .rv-plan-zoom .val.val {
    /* `height` is the property that bit us: the rule below overrode the width,
       the background, the border and the padding, but said nothing about the
       height — so the global `input[type="number"] { height: 40px }` still
       applied and stretched the whole control past its neighbours. A rule that
       reclaims an element from a global one has to name EVERY property that
       global sets, not just the ones that look wrong. */
    height: 24px; line-height: 24px;
    width: 34px; text-align: right; padding: 0; margin: 0;
    background: transparent; border: 0; outline: none;
    font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text);
    -moz-appearance: textfield;
  }
  /* The native spinners duplicate the − / + already sitting either side. */
  .rv-plan-zoom .val.val::-webkit-outer-spin-button,
  .rv-plan-zoom .val.val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .rv-plan-zoom .val.val:focus { color: var(--primary-text); box-shadow: none; border: 0; }
  .rv-plan-zoom .pct { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--muted); padding-right: 4px; }

  /* Alignment guides — the thin line that says WHY the rack just clicked into
     place. They live for the length of the drag and explain the magnet; without
     them a rack that snaps looks like a rack that jumped. */
  .rp-plan-guides { position: absolute; inset: 0; pointer-events: none; z-index: 1001; }
  /* The footprint a resize is heading for. Above the card on purpose: a SHRINK
     draws it inside the rack's current box, and behind it there would be nothing
     to see. Fill kept faint so the slots stay readable through it. */
  .rp-plan-ghost {
    position: absolute; z-index: 1002; pointer-events: none;
    border: 2px dashed var(--primary); border-radius: 12px;
    background: color-mix(in srgb, var(--primary) 7%, transparent);
  }
  .rp-plan-guide { position: absolute; display: block; background: var(--primary); }
  .rp-plan-guide--v { top: 0; bottom: 0; width: 1px; margin-left: -0.5px; }
  .rp-plan-guide--h { left: 0; right: 0; height: 1px; margin-top: -0.5px; }
  /* The rubber band, shared by both boards. Drawn in board coordinates so it
     stays under the pointer at any zoom, and above the cards so you can see
     what it is sweeping. */
  /* The closed hand belongs to the GESTURE, not to the element under the
     pointer. It has to appear on the press itself — before anything has moved —
     and stay closed while the pointer travels over other cards, the mesh, the
     guides or the panel, any of which carries its own cursor. Only a body-level
     override survives crossing all of them.

     `!important` is warranted here, for once: the cards declare `cursor: grab`
     from an id-scoped selector, which no amount of class doubling can outrank,
     and this is a transient state that must win over everything by definition. */
  body.is-plan-grabbing, body.is-plan-grabbing * { cursor: grabbing !important; }

  .rp-plan-marquee {
    position: absolute; z-index: 900; pointer-events: none;
    border: 1px solid var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-radius: 3px;
  }

  /* Racks may overlap — it is the user's plan and nothing is going to shove
     anything aside — but it is never silent.

     The outline is declared in FULL here, not merely recoloured. Only Arrange
     mode gives a card its `outline: 2px solid transparent` base, so outside it
     a lone `outline-color` had no style to paint — and the warning went missing
     in exactly the place it was needed, on a rack dragged by its head in the
     normal view. */
  #invRackView .rp-rack.is-plan-overlapping {
    outline: 2px solid var(--danger); outline-offset: 3px;
  }

  .rp-plan-grip { position: absolute; z-index: 5; display: none; }
  #invRackView.is-plan-edit .rp-plan-grip { display: block; }
  .rp-plan-grip--e  { top: 22px; bottom: 12px; right: -5px; width: 10px; cursor: ew-resize; }
  .rp-plan-grip--s  { left: 12px; right: 22px; bottom: -5px; height: 10px; cursor: ns-resize; }
  .rp-plan-grip--se { right: -7px; bottom: -7px; width: 14px; height: 14px; cursor: nwse-resize; border-radius: 4px; }
  .rp-plan-grip--se { background: var(--surface); border: 2px solid var(--primary); }
  .rp-plan-grip--e:hover, .rp-plan-grip--s:hover { background: color-mix(in srgb, var(--primary) 35%, transparent); border-radius: 5px; }
  .rp-plan-size {
    position: absolute; top: -11px; left: 12px; z-index: 6; display: none;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    background: var(--primary); color: var(--on-accent);
    padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  }
  #invRackView.is-plan-edit .rp-rack.is-plan-selected .rp-plan-size,
  #invRackView.is-plan-edit .rp-rack.is-plan-dragging .rp-plan-size { display: block; }

  /* ═══════════════════════════════════════════════════════════════════
     Colour range filter — "I need THAT orange"
     ═══════════════════════════════════════════════════════════════════
     A hue window laid over a rainbow: drag its middle to change the shade,
     pull either edge to widen it. It is a DISPLAY filter — the racks keep
     their shape and the spools outside the window fade rather than vanish,
     because the point is to see WHERE the colour is on the shelf. */

  /* First row of the view, right under the search band. The bubble and its
     grip stand ~7 px proud of the bar, so the top padding has to clear them
     or a selection near the top would be cut off. */
  /* It lives in the page shell, under the search row and above whatever view is
     showing, so it carries its own spacing rather than borrowing a container's
     gap — which is the right place for it: the breathing room belongs to the
     colour row, and adding it to the search row instead would push the content
     down in the views where these bars are hidden.
     The top has to clear the bubble anyway, which stands five pixels proud of
     the bar plus its shadow; the rest is the air that keeps the spectrum from
     reading as part of the search field. */
  .rv-hue { display: flex; align-items: center; gap: 12px; padding: 18px 2px 6px; }
  /* Hidden where it could not filter anything: the printer views list devices,
     not material, and Lists show what to buy rather than what you own. */
  body.printer-filters .rv-hue,
  body.cam-wall-view .rv-hue,
  body.lists-view .rv-hue { display: none; }
  .rv-hue-bar {
    /* One height, declared once: the grip is cut to the same value below, so a
       taller bar can never leave a grip that no longer lines up with it. */
    --rv-bar-h: 26px;
    /* `pointer`: on a bar with no selection a press drops one where it lands.
       Over a live selection the cursor is set per zone by `hover` in JS. */
    position: relative; min-width: 90px; height: var(--rv-bar-h); border-radius: 8px;
    cursor: pointer; touch-action: none;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.45);
  }
  /* The rainbow gets the lion's share: it spans 360° of hue against a plain
     light-to-dark ramp, so it needs the resolution far more. */
  .rv-hue-bar--hue {
    flex: 3;
    --rv-grad: linear-gradient(90deg,
      hsl(0 85% 55%), hsl(40 90% 52%), hsl(60 85% 48%), hsl(110 62% 42%),
      hsl(160 65% 40%), hsl(190 75% 46%), hsl(220 78% 55%), hsl(265 70% 58%),
      hsl(300 65% 55%), hsl(330 78% 55%), hsl(360 85% 55%));
    background: var(--rv-grad);
  }
  /* White → black, so a position on it is the inverse of lightness. The
     checker under the pale end is what stops a white swatch from vanishing
     into the panel behind it. */
  .rv-hue-bar--lum {
    flex: 1;
    --rv-grad:
      linear-gradient(90deg, #ffffff, #7d7d7d 50%, #000000),
      repeating-conic-gradient(var(--surface-3) 0% 25%, var(--surface) 0% 50%) 0 0 / 10px 10px;
    background: var(--rv-grad);
  }

  /* The selection is a BUBBLE sitting on the bar: three pixels taller than it on
     each side — enough to lift off the bar, little enough that it still belongs
     to it — with corners a touch
     rounder than the bar's own, lifted by a drop shadow. It reads as the
     colour you picked rather than as a frame drawn around it — and since the
     spectrum is never dimmed, height is what marks the choice, not a veil over
     everything else.
     It carries a copy of its bar's gradient, sized to the whole bar and slid
     into place by `redraw`, so a bubble taller than the bar still shows the
     true colours under it with no second gradient to keep in step. The white
     ring with a dark hairline under it survives both a pale yellow and a
     black. */
  .rv-hue-sel {
    position: absolute; top: -3px; bottom: -3px; pointer-events: none;
    border-radius: 8px; overflow: hidden;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.55), 0 3px 10px rgba(0,0,0,.5);
    transition: box-shadow .15s ease;
  }
  .rv-hue-sel-grad { position: absolute; top: 0; bottom: 0; background: var(--rv-grad); }
  /* Only while the wheel is turning — see the wheel handler for why a drag must
     not ease. The gradient inside slides with its bubble, so the spectrum under
     the window stays true frame by frame instead of lagging behind the edges. */
  .rv-hue-bar--eased .rv-hue-sel,
  .rv-hue-bar--eased .rv-hue-sel-grad {
    transition: left .17s cubic-bezier(.4, 0, .2, 1), width .17s cubic-bezier(.4, 0, .2, 1);
  }
  .rv-hue-bar.is-idle .rv-hue-sel {
    box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 0 0 3px rgba(0,0,0,.45);
  }
  .rv-hue-bar.is-edge-l .rv-hue-sel, .rv-hue-bar.is-edge-r .rv-hue-sel {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.55), 0 3px 10px rgba(0,0,0,.5),
                0 0 0 6px rgba(255,255,255,.10);
  }

  /* Hidden by DEFAULT, shown only on the bar that actually holds a selection.
     The rule used to be the other way round — visible unless the bar was marked
     inactive — which meant any state I had not thought of left a handle stranded
     on a bar that filters nothing. Defaulting to invisible puts the burden on
     showing it, which is the side that can be checked by looking. */
  .rv-hue-handle { display: none; }
  .rv-hue-bar:not(.rv-hue-bar--off) .rv-hue-handle { display: block; }
  /* The grip DRAWS NOTHING. A white bar laid over the spectrum read as an object
     dropped on top of the picker rather than a part of it — so what signals a
     grabbable edge is the bubble's OWN edge thickening (below). It is not the
     hit area either: the pointer is routed by ONE zone test in JS (`zoneAt`),
     the same one that picks the cursor, so what the cursor promises is what a
     press does. The button stays for the keyboard (focus + arrow keys), sized
     to the pointer's edge zone so its focus ring outlines that zone. */
  .rv-hue-handle {
    position: absolute; top: -7px; bottom: -7px; width: 14px; z-index: 3;
    background: transparent; border: 0; padding: 0; pointer-events: none;
    transform: translateX(-50%);
  }
  /* Approach an edge and the bubble grows a lip — its own border getting
     thicker, clipped by its own corner radius, so nothing new appears on the
     spectrum. The edge you will take gets the full lip, the other one a thin
     one: the pair still reads as the bubble becoming grabbable (a single lip
     read as a lopsided bubble), and the difference says which edge moves. The
     hairline on the inner face keeps the white lip readable where the gradient
     behind it is white too. A piece cut by the bar's end (`no-l` / `no-r`, a
     window across red) has no edge there and grows no lip. */
  /* Above the gradient, explicitly. `::before` is inserted as the FIRST child,
     so among absolutely-positioned siblings at z-index auto it paints UNDERNEATH
     the gradient copy — the left lip was there at full width and simply buried,
     while `::after`, being last, showed. */
  .rv-hue-sel::before,
  .rv-hue-sel::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 0; z-index: 1;
    background: #fff; transition: width .14s ease;
  }
  .rv-hue-sel::before { left: 0;  box-shadow: inset -1px 0 0 rgba(0,0,0,.35); }
  .rv-hue-sel::after  { right: 0; box-shadow: inset  1px 0 0 rgba(0,0,0,.35); }
  .rv-hue-bar.is-edge-l .rv-hue-sel::after,
  .rv-hue-bar.is-edge-r .rv-hue-sel::before { width: 2px; }
  .rv-hue-bar.is-edge-l .rv-hue-sel::before,
  .rv-hue-bar.is-edge-r .rv-hue-sel::after,
  .rv-hue-bar:has(.rv-hue-handle:focus-visible) .rv-hue-sel::before,
  .rv-hue-bar:has(.rv-hue-handle:focus-visible) .rv-hue-sel::after { width: 6px; }
  .rv-hue-sel.no-l::before, .rv-hue-sel.no-r::after { display: none; }

  /* The body's cue: the app's own chevrons around a filled pill, ‹ ▮ › — a
     mouse wheel between two directions: "scroll or drag this left and right" —
     shown while the pointer is on the body
     (grab cursor) and while it is being slid. They step apart a pixel as they
     appear, the motion they promise. Only on the wider piece of a window cut by
     red; the minimum width (MIN_PX in JS) keeps room for it between the two
     lips. White with a dark halo, like the bubble's ring, so they read on a
     pale yellow as on a deep blue. */
  .rv-hue-sel-grip {
    position: absolute; top: 50%; left: 50%; z-index: 2;
    display: flex; align-items: center; transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 1px rgba(0,0,0,.8)) drop-shadow(0 0 2px rgba(0,0,0,.35));
    opacity: 0; transition: opacity .14s ease; pointer-events: none;
  }
  .rv-hue-sel-grip .icon {
    width: min(18px, calc(var(--rv-bar-h) * .7)); aspect-ratio: 1; height: auto;
    background: #fff; transition: transform .18s cubic-bezier(.4, 0, .2, 1);
  }
  .rv-hue-sel-grip .icon-chevron-l { margin-right: -3px; }
  .rv-hue-sel-grip .icon-chevron-r { margin-left: -3px; }
  .rv-hue-sel-wheel {
    width: min(6px, calc(var(--rv-bar-h) * .24)); height: min(12px, calc(var(--rv-bar-h) * .48));
    border-radius: 999px; background: #fff;
  }
  .rv-hue-bar.is-body .rv-hue-sel.is-main .rv-hue-sel-grip { opacity: 1; }
  .rv-hue-bar.is-body .rv-hue-sel.is-main .rv-hue-sel-grip .icon-chevron-l { transform: translateX(-1px); }
  .rv-hue-bar.is-body .rv-hue-sel.is-main .rv-hue-sel-grip .icon-chevron-r { transform: translateX(1px); }
  /* A grip reached by the keyboard has no pointer nearby to thicken an edge for
     it, so it outlines itself as well — otherwise the arrow keys would move a
     boundary with nothing to say which one. */
  .rv-hue-handle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

  /* Icon-only, and it sits at the HEAD of the search row rather than at the end
     of the colour bars: it clears every filter now, not just the colour window,
     so it belongs where the filtering starts. Sized and shaped like the search
     field beside it, so the row reads as one strip rather than a button parked
     next to it. */
  .rv-hue-reset {
    flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    border: 1px solid var(--border); background: var(--surface-2);
    transition: background .15s, border-color .15s;
  }
  /* Dimmed until it has something to undo. It stays clickable — the click is
     simply a no-op — but a button that looks ready and then does nothing is the
     thing that makes people doubt the control, so it only lights up while a
     search, a selector or a colour window is actually filtering. */
  .rv-hue-reset { opacity: .4; cursor: default; transition: background .15s, border-color .15s, opacity .15s; }
  .rv-hue-reset .icon { background: var(--faint); transition: background .15s; }
  .rv-hue-reset.is-armed { opacity: 1; cursor: pointer; border-color: var(--border-strong); }
  .rv-hue-reset.is-armed .icon { background: var(--primary); }
  .rv-hue-reset.is-armed:hover { background: var(--surface-hover); }
  .rv-hue-reset.is-armed:hover .icon { background: var(--text); }
  /* One full turn as the receipt for a reset that worked. It stays lit for the
     whole turn and only greys out when the glyph comes to rest: the filters are
     already gone by the first frame, so letting the state class win immediately
     would dim the button mid-spin and make the acknowledgement look interrupted.
     Handled here rather than by delaying the state in JS — no timer to keep in
     step with the duration, and nothing to unwind if the click repeats. */
  @keyframes rv-reset-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
  .rv-hue-reset.is-spinning { opacity: 1; border-color: var(--border-strong); }
  .rv-hue-reset.is-spinning .icon { background: var(--primary); animation: rv-reset-spin .5s cubic-bezier(.34, .8, .3, 1); }

  /* Depth control in the storage header — a light button opening the two
     offset sliders. Hidden unless at least one rack actually has a depth. */
  .rv-depth-wrap { position: relative; flex-shrink: 0; align-self: center; }
  .rv-depth-wrap.hidden { display: none; }
  .rv-depth-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 10px;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    border-radius: 9px; font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  }
  .rv-depth-btn:hover { background: var(--surface-hover); color: var(--text); }
  .rv-depth-btn.open { border-color: var(--primary); color: var(--primary-text); }
  .rv-depth-btn .icon { background: currentColor; }
  .rv-depth-pop {
    position: absolute; z-index: 60; top: calc(100% + 6px); right: 0;
    width: 268px; padding: 14px;
    background: var(--surface-raised); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.5);
    display: flex; flex-direction: column; gap: 12px;
  }
  .rv-depth-pop.hidden { display: none; }
  .rv-depth-pop h5 { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--text); }
  .rv-depth-row { display: flex; align-items: center; gap: 9px; }
  .rv-depth-row .lab { width: 14px; flex-shrink: 0; text-align: center; font-size: 13px; color: var(--muted); }
  .rv-depth-row input[type="range"] {
    -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 4px;
    background: var(--surface-3); border-radius: 2px; outline: none; cursor: pointer;
  }
  .rv-depth-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); cursor: grab;
  }
  .rv-depth-row .val {
    font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text);
    min-width: 44px; text-align: right;
  }
  .rv-depth-reset {
    align-self: flex-start;
    padding: 6px 11px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-family: inherit; font-size: 12px; font-weight: 600;
    transition: background .15s, border-color .15s;
  }
  .rv-depth-reset:hover { background: var(--surface-hover); border-color: var(--border-strong); }
  .rv-depth-pop .hint { font-size: 11px; color: var(--faint); line-height: 1.45; margin: 0; }
  /* Depleted-spool visual cue: a thin colored strip at the bottom (so the
     spool's color is still hinted at) + a faded "0g" tag centered on the
     slot. Without this, a 0g spool's .rp-fill has height:0 → looks
     identical to an empty slot. */
  .rp-fill--depleted {
    height: 6px !important;
    opacity: .35;
    bottom: 0;
  }
  .rp-fill-empty-tag {
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono);
    font-size: 9px; font-weight: 700;
    color: rgba(0,0,0,.45);
    letter-spacing: .04em;
    pointer-events: none;
    text-shadow: 0 0 2px rgba(255,255,255,.7);
  }

  /* Filled slot — uses the .rp-fill child to render color + fill level */
  .rp-slot--filled {
    border-style: solid;
    border-color: rgba(0,0,0,.12);
    background: color-mix(in srgb, var(--neutral) 12%, transparent);   /* the "empty" portion above the fill */
    cursor: grab;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
    transition: transform .12s, box-shadow .15s;
  }
  .rp-slot--filled:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 4px 10px rgba(0,0,0,.12);
  }
  .rp-slot--filled:active { cursor: grabbing; }
  /* Read-only mode (friend view) — slots are clickable but not draggable;
     side-rows + slots use the default pointer cursor instead of grab. */
  #invRackView.is-read-only .rp-slot--filled,
  #invRackView.is-read-only .rp-side-row {
    cursor: pointer;
  }
  #invRackView.is-read-only .rp-slot--filled:active,
  #invRackView.is-read-only .rp-side-row:active {
    cursor: pointer;
  }
  /* ── Active drop target — the slot the cursor is hovering over RIGHT NOW.
     Must clearly stand out from the ambient "drop-zone" pulse so the user
     knows where the spool will land if they release the mouse. */
  .rp-slot--drop {
    /* Cancel the body.is-dragging-spool pulse on this specific slot */
    animation: none !important;
    /* Solid orange ring + glow + slight pop */
    border-style: solid !important;
    border-color: var(--primary) !important;
    background: var(--primary-soft) !important;
    box-shadow:
      0 0 0 3px var(--primary),
      0 0 0 6px color-mix(in srgb, var(--primary) 25%, transparent),
      0 6px 18px color-mix(in srgb, var(--primary) 45%, transparent) !important;
    transform: scale(1.12);
    z-index: 3;
    transition: transform .12s cubic-bezier(.34, 1.6, .64, 1),
                box-shadow .12s, border-color .12s;
  }
  /* Filled slot being hovered → swap target. Same ring/glow but keep the
     existing fill visible so the user sees what they're swapping with. */
  .rp-slot--filled.rp-slot--drop {
    background: color-mix(in srgb, var(--neutral) 12%, transparent) !important;   /* preserve original empty bg */
  }
  /* Swap arrow — shown on BOTH slots that will trade places: the landing target
     AND the source slot the user is dragging, so the swap reads clearly from
     either end. On the target alone the native drag ghost sits under the cursor
     and can hide it, hence also showing it on the source. The source is normally
     dimmed to .35 mid-drag — lift it back up so its arrow isn't faint. Toggled by
     the `is-swap-hover` body state (JS: dragenter over an occupied, unlocked,
     non-source slot). */
  body.is-swap-hover .rp-slot--filled.rp-dragging { opacity: .92; }
  .rp-slot--filled.rp-slot--drop::before,
  body.is-swap-hover .rp-slot--filled.rp-dragging::before {
    content: "⇄";
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--on-dark);
    font-size: 16px; font-weight: 700;
    text-shadow: 0 0 4px rgba(0,0,0,.7), 0 0 8px rgba(0,0,0,.5);
    z-index: 4;
    pointer-events: none;
    animation: rp-drop-arrow-in .14s ease-out;
  }
  @keyframes rp-drop-arrow-in {
    from { opacity: 0; transform: scale(.6); }
    to   { opacity: 1; transform: scale(1); }
  }
  .rp-slot--drop-deny {
    animation: none !important;
    border-style: solid !important;
    border-color: var(--danger) !important;
    background: var(--danger-soft) !important;
    box-shadow:
      0 0 0 3px var(--danger),
      0 0 12px rgba(220,38,38,.5) !important;
    cursor: not-allowed;
    transform: scale(1.05);
    z-index: 3;
  }
  .rp-dragging  { opacity: .35; }

  /* Search dim — applied to filled rack slots that don't match the query.
     The slot stays in place but loses color saturation and most opacity, so
     the matching slots visually pop. */
  /* No `transition: filter` — animating filter:grayscale per-frame on 100-300
     slots when the search churns the dim set on every keystroke flashed the
     entire grid. opacity is compositor-friendly so its transition stays. */
  .rp-slot--filled.rp-dim {
    opacity: .18;
    filter: grayscale(.85);
    transition: opacity .15s;
  }
  .rp-slot--filled.rp-dim:hover { opacity: .4; }   /* hint that it's still there */

  /* Search-match indicator on the slot CONTAINER — makes the slot stand
     out via a border+glow on the box itself, NOT via the inner color fill.
     This is critical for depleted spools (.rp-fill height ~ 0): the slot's
     box still glows in orange so the user sees it when they search. */
  /* Static shadow uses the midpoint of the old keyframe so visibility is
     preserved. Pulse is driven by `transform: scale` (compositor-only) instead
     of animating box-shadow — animating shadow forced a GPU repaint on every
     frame, saturating Chromium's tile memory (`tile_manager.cc:997 WARNING:
     tile memory limits exceeded`) when ~15+ matches were on screen. */
  .rp-slot--filled.rp-slot--match {
    border-color: var(--primary) !important;
    box-shadow:
      0 0 0 2.5px color-mix(in srgb, var(--primary) 70%, transparent),
      0 0 11px color-mix(in srgb, var(--primary) 70%, transparent),
      inset 0 0 0 1px var(--ink-30);
    z-index: 2;
    animation: rp-slot-match-pulse 1.6s ease-in-out infinite;
    /* Pre-promote to a compositor layer so the rack-hover reveal (which expands
       `.rp-row--header` from 0 → 14px and shifts every slot below it) doesn't
       re-rasterize the scaled match-slots — that re-rasterization was visible
       as a brief flash and also re-triggered `tile_manager` warnings. */
    will-change: transform;
  }
  @keyframes rp-slot-match-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
  }
  /* Hover on a match slot: pause the pulse and snap back to scale(1) — the
     parent `.rp-slot--filled:hover` rule applies `transform: translateY(-1px)`,
     which would override the animation's `transform: scale` and cause a visible
     flash whenever the mouse swept across multiple animating match-slots. The
     permanent orange ring already provides ample hover affordance here. */
  .rp-slot--filled.rp-slot--match:hover {
    animation: none;
    transform: scale(1);
  }

  /* Locked slot — solid amber tint + small lock badge top-right.
     Right-click toggles the lock (handled in JS). */
  /* Locked slots split into two distinct states (see renderRackView):
       • .rp-slot--unusable = locked + EMPTY  → dead, non-storable (grey hatch)
       • .rp-slot--pinned   = locked + FILLED → material pinned (amber + badge)
     Both keep the not-allowed cursor; everything else differs. */
  .rp-slot--locked { cursor: not-allowed !important; }

  /* Case 1 — unusable empty slot: grey diagonal hatch, no icon (the stripes
     read clearly on their own). Excluded from the "available" slot count. */
  .rp-slot--unusable,
  .rp-slot--unusable:hover {
    border: 1.5px solid var(--border) !important;
    background:
      repeating-linear-gradient(45deg,
        rgba(128, 128, 128, .22) 0 1.5px,
        transparent 1.5px 7px),
      var(--surface) !important;
    opacity: .7;
  }

  /* Case 2 — pinned filled slot: keep the spool fill, add an amber border
     and a small lock badge in the top-right corner. */
  .rp-slot--pinned {
    border: 2px solid var(--warning) !important;
  }
  .rp-slot--pinned::before {
    content: "";
    position: absolute;
    top: 2px; right: 2px;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: var(--warning);
    z-index: 2;
    pointer-events: none;
  }
  .rp-slot--pinned::after {
    content: "";
    position: absolute;
    top: 5px; right: 5px;
    width: 11px; height: 11px;
    background-color: var(--surface);
    -webkit-mask-image: url('../../assets/svg/icons/icon_lock.svg');
            mask-image: url('../../assets/svg/icons/icon_lock.svg');
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
    z-index: 3;
    pointer-events: none;
  }

  /* Ghost variant of the rack-view CTA — used by "Auto-fill" */
  .rp-cta--ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
  }
  .rp-cta--ghost:hover {
    background: var(--surface-2);
    border-color: var(--primary);
  }
  .rp-cta--ghost .icon { background: var(--text); }
  .rp-cta:disabled { opacity: .5; cursor: not-allowed; }

  /* ──────────────────────────────────────────────────────────────────
     Racks fill the full width — the unranked panel is a slide-in
     ────────────────────────────────────────────────────────────────── */
  .rp-racks-col {
    /* Tight masonry — children are absolutely-positioned by JS using a
       skyline-packing algorithm so each rack hugs its natural width AND
       is placed at the lowest available position. CSS only sets the
       container as a positioning context. JS handles the rest. */
    position: relative;
    min-width: 0;
  }
  .rp-racks-col > .rp-rack,
  .rp-racks-col > .rp-rack-add {
    /* JS sets position/left/top — no CSS margins (we use explicit gaps in JS) */
    margin: 0;
  }
  /* Storage board: fills the remaining height. Racks scroll on the left, the
     "not stored" panel is a full-height docked column on the right. */
  .rp-board { flex: 1; min-height: 0; display: flex; gap: 14px; align-items: stretch; overflow: hidden; }
  /* Racks area scrolls on its own (header stays put, panel stays full-height). */
  /* Both axes scroll: with racks placed by hand the plan is as likely to run
     off to the right as off the bottom. The wheel scrolls it, holding the wheel
     button pans it, and thin bars (below) show where you are. */
  .rp-racks-scroll { flex: 1; min-width: 0; overflow: auto; overscroll-behavior: contain; }
  /* The empty board reads as draggable, because it is. Cards set their own
     cursors on top of this. */
  .rp-racks-scroll { cursor: grab; }
  .rp-racks-scroll .rp-rack { cursor: default; }
  .rp-racks-scroll.is-panning, .rp-racks-scroll.is-panning .rp-rack { cursor: grabbing; user-select: none; }
  /* Nothing inside reacts while panning, or a rack would think it is being
     dragged and the pan would leave a mess behind it. */
  .rp-racks-scroll.is-panning * { pointer-events: none; }
  /* The wheel scrolls the board (Ctrl / ⌘ + wheel zooms, #323): thin bars show where you are. */
  .rp-racks-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
  .rp-racks-scroll::-webkit-scrollbar-track, .rp-racks-scroll::-webkit-scrollbar-corner { background: transparent; }
  .rp-racks-scroll::-webkit-scrollbar-thumb { background: var(--ink-15); border-radius: 3px; }
  .rp-racks-scroll > .rp-racks-col { min-width: 0; }
  /* Permanently-docked unranked-spools panel — ALWAYS visible (even empty) so it
     reads as the clear "drop here to un-rack" zone. Full board height; its list
     scrolls inside. */
  .rp-side {
    flex-shrink: 0; width: 300px;
    align-self: stretch; min-height: 0;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    overflow: hidden;
  }
  /* Header toggle — pill button with count badge */
  .rp-toggle-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 6px; margin-left: 4px;
    background: var(--primary); color: var(--on-accent);
    border-radius: 9px;
    font-size: 11px; font-weight: 700;
  }
  .rp-side-head {
    display: flex; align-items: center; gap: 8px;
  }
  .rp-side-title {
    font-size: 11px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--muted);
  }
  .rp-side-count {
    background: var(--primary); color: var(--on-accent);
    border-radius: 10px; padding: 1px 8px;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;     /* badge sits before the title — push close button to the right via the title's flex */
  }
  .rp-side-title { flex: 1; min-width: 0; }
  /* Contextual "Add Rack" CTA inside the "Spools not stored" side panel.
     Shown when there are more unstored spools than free slots — i.e. the
     user is out of capacity. Orange accent to match the "not stored" pill
     in the stats bar so the two read as related/urgent affordances. */
  .rp-side-add-rack {
    display: flex; flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
    border-radius: 8px;
    flex-shrink: 0;
  }
  .rp-side-add-rack-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: var(--on-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    flex: 1;
  }
  .rp-side-add-rack-btn:hover  { background: var(--primary); filter: brightness(1.07); }
  .rp-side-add-rack-btn:active { transform: translateY(1px); }
  .rp-side-add-rack-btn .icon  { background: var(--on-accent); }
  /* Info bubble — small ⓘ that reveals an explanation on hover/focus (replaces
     the inline help text). Styled bubble, NOT a native title. */
  /* The bubble itself is rendered via the shared #toolInfoPop (body-appended,
     position:fixed) — same as the toolbox ⓘ tips — so it escapes the panel's
     overflow/stacking instead of being clipped inside the card. Wired in JS
     (_wireRackInfoTips → _showToolInfoTip). Here we only style the icon. */
  .rp-info { display: inline-flex; align-items: center; cursor: help; flex-shrink: 0; }
  .rp-info .icon { background: var(--muted); transition: background .15s; }
  .rp-info:hover .icon, .rp-info:focus-visible .icon { background: var(--primary); }

  /* Auto storage / Auto unstorage toggles inside the "Spools not stored"
     panel. The two opposing policies live together in a single bordered
     card with a thin divider between them, so the user reads them as a
     paired automation choice. */
  .rp-side-auto-card {
    display: flex; flex-direction: column;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
  }
  .rp-side-auto-card .rp-side-toggle + .rp-side-toggle {
    border-top: 1px solid var(--border);
  }
  .rp-side-toggle {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    user-select: none;
  }
  .rp-side-toggle-label {
    flex: 1; min-width: 0;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 600; color: var(--text);
  }
  .rp-side-toggle .eac-toggle { flex-shrink: 0; cursor: pointer; }
  .rp-side-search { position: relative; flex-shrink: 0; }
  .rp-side-search .icon {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: var(--muted); pointer-events: none;
  }
  .rp-side-search input {
    width: 100%; padding: 7px 30px 7px 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 12px;
    font-family: inherit; outline: none;
    transition: border-color .15s;
  }
  .rp-side-search input:focus { border-color: var(--primary); }
  /* Clear button — reuses `.inv-search-clear` from the main search bar, retuned for
     this smaller field. It REPLACES the magnifier rather than sitting next to it:
     one glyph, always in the same spot, so nothing shifts and the input keeps its
     original padding. The magnifier stands down as soon as there is text. */
  .rp-side-search .inv-search-clear { right: 8px; width: 18px; height: 18px; }
  .rp-side-search:has(.inv-search-clear:not([hidden])) .icon-search { display: none; }
  .rp-side-list {
    flex: 1; min-height: 0;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px;
    padding-right: 2px;
  }
  .rp-side-list::-webkit-scrollbar { width: 4px; }
  .rp-side-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .rp-side-list--drop,
  .rp-unranked-strip--drop {                  /* legacy id-target compat */
    outline: 2px dashed var(--primary);
    outline-offset: -4px;
    border-radius: 10px;
    background: var(--primary-soft);
  }
  /* When the list is EMPTY, the empty-state block already shows its own dashed
     drop zone — don't add a second outline around it. */
  .rp-side-list--drop:has(.rp-unranked-empty) { outline: none; background: transparent; }
  .rp-side-list--drop .rp-unranked-empty {
    animation: none;                           /* steady (no pulse) while hovered */
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
  }
  .rp-unranked-empty {
    flex: 1; min-height: 140px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    text-align: center; padding: 18px 12px;
    font-size: 12px; color: var(--muted);
    border: 2px dashed var(--border); border-radius: 12px;
  }
  /* When the list has spools, the drop-zone block is hidden — UNTIL a spool is
     being dragged: then the rows vanish and the drop zone takes over, giving a
     clear free area to drop onto. (When the list is empty it's always shown.) */
  .rp-side-list.has-rows .rp-unranked-empty { display: none; }
  /* Gated on is-dragging-RACKED (a spool dragged out of a rack), NOT any drag —
     dragging a row FROM the panel must keep the rows so the source isn't yanked. */
  body.is-dragging-racked .rp-side-list.has-rows .rp-side-row { display: none; }
  body.is-dragging-racked .rp-side-list.has-rows .rp-unranked-empty { display: flex; }
  .rp-unranked-empty .icon { background: var(--muted); opacity: .55; transition: background .15s, opacity .15s; }
  .rp-unranked-empty-title { font-weight: 600; color: var(--text); }
  .rp-unranked-empty-hint { font-size: 11px; line-height: 1.35; opacity: .85; max-width: 200px; }
  .rp-unranked-empty-disabled { display: none; font-size: 11.5px; line-height: 1.35; max-width: 210px; color: var(--muted); }
  /* (No ambient orange illumination of the drop zone while dragging — removed by
     request. The zone still shows and accepts the drop to unrack; it just stays
     neutral instead of lighting the whole card up.) */
  /* Auto storage ON: the bin still accepts the drop (dropping there is an
     explicit opt-out that turns Auto storage OFF), but the note swaps in to warn
     about that side effect — shown instead of the normal hint. */
  body.autostore-on.is-dragging-racked .rp-unranked-empty-hint { display: none; }
  body.autostore-on.is-dragging-racked .rp-unranked-empty-disabled { display: block; color: var(--primary-text); }
  /* Single unranked-spool row — horizontal: puck + name + weight */
  .rp-side-row {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: grab;
    transition: border-color .15s, background .15s, transform .12s;
  }
  .rp-side-row:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateX(-1px);
  }
  .rp-side-row:active { cursor: grabbing; }
  /* Empty spool locked by Auto Unstorage — can't be stored (would bounce back). */
  .rp-side-row--locked {
    position: relative;
    opacity: .6; cursor: not-allowed;
  }
  .rp-side-row--locked:hover { border-color: var(--border); background: var(--surface); transform: none; }
  .rp-side-row--locked:active { cursor: not-allowed; }
  .rp-side-row-lock { position: absolute; top: 8px; right: 8px; background: var(--muted); }
  /* Smaller illustration here (~30% less than the group panel's 65px) — override
     the `.gp-member .thumb { 65px }` rule (the colour-square gets 45 inline). */
  .rp-side-row.gp-member .thumb { width: 72px; height: auto; object-fit: contain; }
  /* The whole row is the single drag source: neutralise children so clicking the
     image (or anything) grabs the CARD, not the native image. */
  .rp-side-row > * { pointer-events: none; }
  .rp-side-row img { -webkit-user-drag: none; user-drag: none; }
  .rp-side-puck {
    /* Match the rack-slot dimensions exactly: 32px wide, 3/5 aspect → ~53px
       tall. Visually consistent with what the user sees inside the racks, so
       a glance recognises the same "spool box" shape in both views. */
    width: 32px;
    aspect-ratio: 3 / 5;
    flex-shrink: 0;
    border-radius: 5px;
    border: 1.5px solid rgba(0,0,0,.12);
    background: color-mix(in srgb, var(--neutral) 12%, transparent);
    position: relative; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }
  .rp-side-meta {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
  }
  .rp-side-name {
    font-size: 12px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .rp-side-sub {
    font-size: 10.5px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .rp-side-w {
    font-size: 11px; font-weight: 600; color: var(--text);
    flex-shrink: 0; font-family: var(--mono);
    text-align: right;
  }
  .rp-side-w-unit {
    display: block; font-size: 9px; font-weight: 500;
    color: var(--muted); margin-top: 1px;
  }

  /* "Frame" wrapper around the slots — gives a slight inset to suggest the
     metal frame of a physical rack. */
  /* Inner frame — kept as a layout wrapper so future tweaks (padding, gap) can
     target the slot area without affecting the rack head. No visual chrome
     anymore: the surrounding rack card already provides the container, an
     inner frame just adds noise. */
  .rp-frame {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  /* Chip = a draggable spool puck (legacy — used in older code paths) */
  .rp-chip {
    aspect-ratio: 3 / 5;
    border-radius: 5px;
    border: 1.5px solid rgba(0,0,0,.12);
    background: color-mix(in srgb, var(--neutral) 12%, transparent);
    position: relative;
    overflow: hidden;
    cursor: grab;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
    transition: transform .12s, box-shadow .15s;
  }
  .rp-chip:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 4px 10px rgba(0,0,0,.12);
  }
  .rp-chip:active { cursor: grabbing; }

  /* Empty state — shown when the user has no rack yet. Photo of a real
     filament rack to suggest what Storage is for. */
  .rp-empty {
    text-align: center;
    padding: 28px 18px 32px;
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    width: 100%;
  }
  .rp-empty-img {
    display: block;
    max-width: 220px;
    width: 60%;
    height: auto;
    margin: 0 auto 16px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.18));
    opacity: .92;
  }
  /* legacy icon variant — kept for backwards compat in case someone calls it */
  .rp-empty-icon {
    width: 48px; height: 48px; margin: 0 auto 12px;
    background: var(--primary-soft);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
  }
  .rp-empty-icon .icon { background: var(--primary); }
  .rp-empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
  .rp-empty-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; max-width: 320px; margin: 0 auto; }
  .rp-empty-cta {
    margin: 18px auto 0;
    display: inline-flex;       /* override .rp-cta which is inline-flex but inherits centering from parent */
  }

