/* ── 40-printers.css — Printers list view + add/scan/manual modals + side panel ── */
  /* ═══════════════════════════════════════════════════════════════════
     Printers view — read-only listing of users/{uid}/printers/{brand}/devices
     ═══════════════════════════════════════════════════════════════════ */
  .inv-printer-view {
    display: flex; flex-direction: column; gap: 18px;
    padding: 0 0 4px;
    margin-top: var(--view-gap);
    flex: 1; min-height: 0;
    /* The VIEW no longer scrolls — the board inside it does. Two nested
       scrollers fight each other, and panning has to move the one that holds
       the coordinates. */
    overflow: hidden;
    scrollbar-width: none;                 /* Firefox — hide the vertical scrollbar */
  }
  .inv-printer-view::-webkit-scrollbar { width: 0; height: 0; }   /* Chromium */
  .inv-printer-view.hidden { display: none; }

  /* The Search views keep one select of their own: the sort. */
  #cvFilters { display: none; }
  body.catalog-filters #cvFilters { display: flex; align-items: center; gap: 6px; }

  .printers-section {
    display: flex; flex-direction: column; gap: 10px;
  }
  .printers-section-head {
    display: flex; align-items: center; gap: 8px;
    padding: 0 2px;
  }
  .printers-section-dot {
    width: 8px; height: 8px; border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(0,0,0,.04);
  }
  .printers-section-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    letter-spacing: .2px;
  }
  .printers-section-count {
    font-size: 12px; color: var(--muted);
    background: var(--surface-2);
    padding: 1px 8px; border-radius: 999px;
    font-weight: 500;
  }

  /* There is no flow layout left: the printer view is a board, and a board
     places its cards by coordinate. The grid and flex variants that used to lay
     them out were the old organisation — they fought the absolute positioning
     and were the last thing still deciding where a machine went. */
  .printers-grid { display: block; position: relative; }

  /* The board's own scroller — the cards never move, this does. */
  .printers-scroll {
    flex: 1; min-height: 0; overflow: auto;
    position: relative;
  }
  /* The wheel scrolls the board (Ctrl / ⌘ + wheel zooms, #323): thin bars show where you are. */
  .printers-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
  .printers-scroll::-webkit-scrollbar-track, .printers-scroll::-webkit-scrollbar-corner { background: transparent; }
  .printers-scroll::-webkit-scrollbar-thumb { background: var(--ink-15); border-radius: 3px; }
  .printers-scroll.is-panning { cursor: grabbing; user-select: none; }
  /* Same row as Storage's: the arrange toggle first — it is an action you take
     while placing machines — then the zoom. */
  /* The controls float OVER the board, top right, instead of sitting on a strip
     above it. That strip cost a full row of height on every screen for two
     controls used occasionally — and the board is the thing you came to look at.
     Floating also puts them where the eye already goes when it wants a control,
     the same corner every map application uses.

     Anchored to the VIEW, not to the board. Sticky inside the scroller only
     holds vertically — pan sideways and the controls sail off with the content —
     so they are placed against the view itself, which does not scroll. */
  .pv-plan-bar {
    position: absolute; top: 8px; right: 10px; z-index: 60;
    display: flex; align-items: center; gap: 8px;
    pointer-events: none;
  }
  /* Only the controls themselves take the pointer; the strip between them must
     not swallow a rubber band started near the top of the board. */
  .pv-plan-bar > * { pointer-events: auto; }


  /* Connect / Disconnect button in the printer side-card header.
     data-conn="active"   → printer is connected or connecting → danger tint (clicking disconnects)
     data-conn="inactive" → printer is offline / unknown       → accent tint  (clicking connects) */
  #printerConnBtn[data-conn="active"] {
    color: var(--danger-text);
  }
  #printerConnBtn[data-conn="active"]:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger-text);
  }
  #printerConnBtn[data-conn="inactive"] {
    color: var(--primary-text);
  }
  #printerConnBtn[data-conn="inactive"]:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary-text);
  }
  /* ── The printer plan ──────────────────────────────────────────────────
     Cards placed by hand rather than reflowed by state. Absolute inside a
     positioned board, exactly like the storage plan — where a machine sits is
     something you decide once. */
  .printers-grid--plan { display: block; position: relative; }
  .printers-grid--plan .printer-card {
    position: absolute; margin: 0; flex: none; width: var(--board-card-w);
    /* Laid out like a rack card: the name on a head row at the top, the
       machine centred in the body below it. */
    padding: 12px; gap: 10px; min-height: 150px;
  }
  /* Grab is offered where a grab is possible. Outside Arrange the card opens a
     panel and only its handle moves it, so a card-wide `grab` would promise a
     drag that the card no longer accepts. */
  #invPrinterView.is-plan-edit .printers-grid--plan .printer-card { cursor: grab; }
  /* ── The three states of a board object, in the order they must win ──────
     Held < selected < colliding. Written together and at ONE specificity so
     the outcome is decided by this order rather than by which selector happens
     to carry an extra class — that is how a lift ended up outranking a
     collision warning once already. */
  .printers-grid--plan .printer-card.is-plan-dragging,
  .printers-grid--plan .slots-card.is-plan-dragging {
    cursor: grabbing; box-shadow: 0 14px 34px rgba(0,0,0,.45);
    /* HELD. Without it the only sign was a shadow, which on a dark board under
       a card that had barely moved yet is no sign at all — you could not tell
       a grab that took from one that missed. */
    outline: 2px solid var(--primary); outline-offset: 2px;
  }
  .printers-grid--plan .printer-card.is-plan-selected,
  .printers-grid--plan .slots-card.is-plan-selected {
    outline: 2px solid var(--primary); outline-offset: 2px;
  }
  .printers-grid--plan .printer-card.is-plan-overlapping,
  .printers-grid--plan .slots-card.is-plan-overlapping {
    outline: 2px solid var(--danger); outline-offset: 2px;
  }

  /* ── A cluster: cards bound together for good ────────────────────────────
     One outline around the whole set, behind the cards it rings, so what
     belongs together is readable without touching anything. Deaf to the
     pointer: it is a mark ON the board, not an object on it — pressing the
     empty space inside it must still start a selection sweep. */
  .printers-grid--plan .plan-cluster {
    /* The z is set by the layout, just under the group's own lowest card — a
       fixed 0 here left the ring behind every machine on the board, including
       the ones its group had just been moved on top of. */
    position: absolute; pointer-events: none;
    border: 1.5px dashed color-mix(in srgb, var(--primary) 55%, transparent);
    border-radius: 20px;
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    /* SHOWN ONLY WHILE SOMETHING IS BEING MOVED. At rest the rings describe a
       state you already know and cover the board in orange — on a busy plan
       they compete with the cards they are meant to serve. During a move they
       are the one thing you need: which objects are coming with you. Every ring
       appears, not just the one you took, so you can also see what you are
       about to land among. Opacity rather than display, so the layout keeps
       patching them in place and they fade rather than blink. */
    opacity: 0;
    transition: opacity .14s ease-out;
  }
  body.is-plan-grabbing .printers-grid--plan .plan-cluster { opacity: 1; }
  /* The board's own right-click menu. Same component as a kebab menu — it just
     drops from the cursor instead of from a button, so it grows from the corner
     the pointer is in. */
  .rp-menu--ctx { transform-origin: top left; }
  .rp-menu--ctx .rp-menu-item[disabled] { opacity: .45; cursor: default; }
  .rp-menu--ctx .rp-menu-item[disabled]:hover { background: transparent; }
  .rp-menu--ctx .rp-menu-item[disabled]:hover .icon { background: var(--muted); }
  .rp-menu-hint {
    padding: 2px 12px 6px; max-width: 230px;
    font-size: 11px; line-height: 1.35; color: var(--muted);
  }

  /* ── The slot widget ─────────────────────────────────────────────────────
     The machine's bays as their OWN object on the board, so a unit can be put
     where it really stands rather than stuck under the card of the machine it
     feeds. Deliberately quieter than a printer card — it is an accessory, and
     two things competing for attention side by side read as two machines. */
  .printers-grid--plan .slots-card {
    /* Sized to its bays, not to a machine card. Now that a square is a fixed
       size, a fixed-width widget just leaves dead space to the right of a
       four-bay machine — and dead space next to content reads as something
       missing. Capped at a card's width so a long machine name cannot stretch
       it out of proportion. */
    /* The shared width as a FLOOR, not a cap: a one-slot unit still matches the
       machine card beside it, and a five-slot one is allowed to be wider rather
       than squeezing its squares. Uniform where it can be, honest where it
       cannot. */
    /* max-content, NOT fit-content. On an absolutely positioned box fit-content
       is capped by the space left to the container's right edge, so the same
       widget was one width in the middle of the board and a narrower, wrapped
       one near the edge — a Snapmaker's five pills folding onto two rows and
       the card changing size as you dragged it. max-content asks only what the
       content needs; the board then grows to hold it, which is what a plan you
       pan around is for. */
    position: absolute; width: max-content; min-width: var(--board-card-w);
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 14px;
  }
  /* Last known, not live. The machine is off or unreachable, so what is drawn
     is the record rather than a reading — dimmed and desaturated, because
     showing stale contents as though they were current is the one version of
     this that would actually mislead. It still reads: you can see what is in
     the boxes, you just cannot mistake it for now. */
  .printers-grid--plan .slots-card.is-stale { opacity: .55; }
  .printers-grid--plan .slots-card.is-stale .pcs-slot { filter: saturate(.35); }
  .printers-grid--plan .slots-card.is-stale:hover { opacity: .85; }
  .slots-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  /* Whose bays these are. The widget is meaningless without it — a row of
     squares floating on a board belongs to nothing. */
  .slots-card-name {
    font-size: 12px; font-weight: 700; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* Which machine a lone unit feeds. Only shown when the units are split: in a
     group the card is already named after the machine, and repeating it under
     its own title would say nothing. */
  .slots-card-owner {
    font-size: 10px; font-weight: 600; color: var(--muted); opacity: .65;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .printers-grid--plan .slots-card .rp-rack-btn { opacity: 0; transition: opacity .15s, background .15s; }
  .printers-grid--plan .slots-card:hover .rp-rack-btn,
  .printers-grid--plan .slots-card .rp-rack-btn:focus-visible { opacity: 1; }
  .printers-grid--plan .slots-card .rp-rack-move { cursor: grab; }
  .printers-grid--plan .slots-card .rp-rack-kebab[aria-expanded="true"] { opacity: 1; }
  /* Inside the widget the strip is the content, not a footnote under a bar. */
  .slots-card .printer-card-slots { margin-top: 0; }



  /* ── The temperature widget ──────────────────────────────────────────────
     The machine's own temperature pills, at board size. The panel's block
     chrome — its section frame and heading — is dropped: the widget already has
     a head saying what it is, and a title inside a title is the redundancy the
     board is meant to avoid. */
  .temp-card .temp-card-body .snap-block { margin: 0; padding: 0; border: 0; background: none; }
  .temp-card .temp-card-body .snap-block-title { display: none; }
  /* Read-only here. The pills are editable setpoints in the panel, and their
     editors live there — offering a control that does nothing would be worse
     than offering none. */
  .temp-card .temp-card-body { pointer-events: none; }
  .temp-card .temp-card-body .snap-temp { cursor: default; }
  .temp-card .temp-card-body .snap-temp-row,
  .temp-card .temp-card-body .snap-temps { flex-wrap: wrap; gap: 6px; }
  /* The widget keeps a machine card's width, so every column of the board is one
     width whatever the machine: it used to grow with its pills and stick out of
     its column (a Snapmaker's four heads and bed, or a dual-nozzle H2). The row
     gives its pills the whole width, which is exactly four pills; a row of five
     (four heads and the bed) shares it between them and reads a size smaller
     rather than folding onto a second line. Six or more still wrap. */
  .printers-grid--plan .slots-card.temp-card { width: var(--board-card-w); min-width: 0; max-width: var(--board-card-w); }
  .temp-card .temp-card-body .snap-temps { padding-inline: 0; gap: 5px; }
  .temp-card .temp-card-body .snap-temps:has(> .snap-temp:nth-child(5)):not(:has(> .snap-temp:nth-child(6))) { gap: 3px; }
  .temp-card .temp-card-body .snap-temps:has(> .snap-temp:nth-child(5)):not(:has(> .snap-temp:nth-child(6))) .snap-temp { min-width: 0; padding-inline: 1px; }
  .temp-card .temp-card-body .snap-temps:has(> .snap-temp:nth-child(5)):not(:has(> .snap-temp:nth-child(6))) .snap-temp-val { font-size: 10px; letter-spacing: -.2px; }
  /* One block per unit — an AMS, a holder pair, the spool arm. They are separate
     objects on the bench, so they are separated here too rather than run into
     one long line. */
  .slots-unit { display: flex; flex-direction: column; gap: 5px; }
  .slots-unit + .slots-unit { margin-top: 10px; }
  .slots-unit-name {
    font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--muted);
  }

  /* ── Feed slots ──────────────────────────────────────────────────────────
     What the machine is holding right now, under its progress bar. Colour is
     the message; the name comes on hover. The strip only exists while connected,
     so its absence already says "no live link" without a word. */
  /* The SAME bay as a rack's in PICTURE view: 64 px square, 6 px apart — the
     numbers come from `.rp-slotview-photo .rp-row-slots` / `.rp-slot` in the
     storage view, not from a value chosen to look right here. That view's slot
     is square because what sits in it is square; the colour view's 3/5 box is
     a spool seen from the front, a different drawing of the same bay. A machine
     bay and a shelf bay hold the same object, so neither may look like a
     different size. Change these only alongside the rack. */
  #invPrinterView {
    /* The board's controls hover over it, so it is their frame of reference. */
    position: relative;
    --pcs-size: 64px; --pcs-gap: 6px;
    /* ONE width for everything on the board. Derived, not chosen: it is exactly
       what a four-slot unit measures — 12 px of padding and 1 px of border on
       each side, plus four squares and the three gaps between them — so a
       machine card and the unit beside it line up instead of one being
       mysteriously two pixels narrower. Change a slot's size and this follows,
       which is the whole point of computing it rather than picking a number. */
    --board-card-w: calc(26px + 4 * var(--pcs-size) + 3 * var(--pcs-gap));
  }
  .printer-card-slots {
    /* ONE size for every bay, on every card. Columns used to be `1fr`, so the
       square's size depended on how many the machine had — a four-bay machine
       drew bigger squares than a five-bay one standing next to it, and the eye
       read that as a difference in importance. A bay is a bay: same square
       everywhere, like the slots of a rack. */
    display: grid;
    grid-template-columns: repeat(var(--pcs-cols, 5), var(--pcs-size));
    justify-content: start;
    gap: var(--pcs-gap); margin-top: 10px;
  }
  /* The same square the machine's own panel draws, sized for a board card. Kept
     square by its own ratio, but capped: eight bays on a two-AMS machine must
     not turn the card into a column of tiles. */
  .pcs-slot {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: var(--pcs-size); aspect-ratio: 1 / 1;
    border-radius: 5px;
    background: var(--pcs-color, var(--surface-3));
    color: var(--pcs-ink, var(--text));
    /* A mid-grey ring rather than a black one: black filament on a dark board
       has no edge of its own and the square dissolves into the card, while a
       black ring would vanish on a white spool. Grey reads against both. */
    box-shadow: inset 0 0 0 1px rgba(128,132,148,.42);
    overflow: hidden;
  }
  .pcs-slot-txt {
    font-size: 11px; font-weight: 800; letter-spacing: .02em; line-height: 1;
    text-transform: uppercase;
    max-width: 100%; padding: 0 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* An empty bay is drawn, not skipped — the count of places is information in
     itself, and a strip that shortened when a spool ran out would read as the
     machine having lost a slot. */
  .pcs-slot.is-empty {
    background: transparent;
    color: var(--muted);
    box-shadow: inset 0 0 0 1px var(--border-strong);
  }
  /* Told what it holds, but holding nothing. Its own colour as a ring so you
     can still see WHICH filament the bay is set to, and a hollow centre so you
     cannot mistake it for one that is loaded — exactly what the machine's own
     panel draws. */
  .pcs-slot.is-unmounted {
    background: transparent;
    color: var(--muted);
    box-shadow: inset 0 0 0 2px var(--pcs-color, var(--border-strong));
  }
  /* Instant tooltip, no native `title` delay. Same technique as the crop tool. */
  .pcs-slot::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%) translateY(3px);
    padding: 5px 9px; border-radius: 7px;
    background: var(--dark-surface); color: var(--on-dark);
    font-size: 11px; font-weight: 600; white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    opacity: 0; pointer-events: none; z-index: 20;
    transition: opacity .12s ease, transform .12s ease;
  }
  .pcs-slot:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
  /* The end chips anchor to their own edge instead of centring: a card sitting
     at the left of the board had its first label cut in half by the window. */
  .pcs-slot:first-child::after  { left: 0; transform: translateY(3px); }
  .pcs-slot:first-child:hover::after { transform: translateY(0); }
  .pcs-slot:last-child::after   { left: auto; right: 0; transform: translateY(3px); }
  .pcs-slot:last-child:hover::after  { transform: translateY(0); }
  /* The ⋮ shows on hover only — the same rule the racks use, so a resting board
     shows machines rather than controls. */
  .printers-grid--plan .printer-card .rp-rack-btn { opacity: 0; transition: opacity .15s, background .15s; }
  .printers-grid--plan .printer-card:hover .rp-rack-btn,
  .printers-grid--plan .printer-card .rp-rack-btn:focus-visible,
  .printers-grid--plan .printer-card .rp-rack-kebab[aria-expanded="true"] { opacity: 1; }
  /* The one control whose press is a drag, not a click — so it says so, and it
     is the only thing on a resting card that offers to be grabbed. */
  .printers-grid--plan .printer-card .rp-rack-move { cursor: grab; }
  .printers-grid--plan .printer-card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  }
  .printers-grid--plan .printer-card-thumb {
    /* ALWAYS the frame a feed would need, photo or no photo. Sized by the image
       inside it, the box was one height with a product shot and a taller one
       with a 16:9 stream — so a card grew the moment you pressed play and the
       whole column shifted under it. The height is stated from the board's card
       width instead, and the photo is simply centred in it: pressing play swaps
       the contents and moves nothing. Stated outright rather than as an
       aspect-ratio, because the card sizes itself to its content and a
       percentage inside it resolves to nothing. */
    flex: none; height: calc(var(--board-card-w) * 9 / 16);
    display: flex; align-items: center; justify-content: center; min-height: 0;
    /* Not clipped on the board: the job keys stack down the left edge under the
       brand badge and the photo area is only as tall as the card lets it be, so
       clipping would cut the stop key in half. Safe — the photo itself is bounded
       by its own max-width/max-height, so nothing else can spill. */
    overflow: visible;
  }
  .printers-grid--plan .printer-card-thumb img { max-width: 100%; max-height: 100px; object-fit: contain; }
  /* The track is always drawn on a reachable machine — an empty one says
     "connected, idle" just as clearly as a full one says "nearly done". */
  .printer-card-prog {
    height: 4px; border-radius: 999px; overflow: hidden;
    background: var(--surface-3); flex: none;
  }
  .printer-card-prog > span {
    display: block; height: 100%; width: 0;
    border-radius: inherit; background: var(--primary);
    transition: width .4s ease;
  }

  /* THE SAME mesh as the storage board — two scales of line, drawn on the
     SCROLLER at true screen size rather than on the scaled canvas (where it
     would shrink with the zoom and cover only a fraction of the board), with
     `background-attachment: local` so it travels with the content and stays
     lined up with the machines while panning. `--plan-z` carries the zoom, so
     the mesh keeps matching the 24 px snap step at any scale. Shown only while
     arranging or actually moving one — the rest of the time a mesh under the
     machines is noise. */
  #invPrinterView.is-plan-edit .printers-scroll,
  #invPrinterView.is-plan-moving .printers-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 graph paper, not a guide. */
  #invPrinterView.is-plan-coarse.is-plan-edit .printers-scroll,
  #invPrinterView.is-plan-coarse.is-plan-moving .printers-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));
  }

  .printer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 14px 14px 26px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color .15s, transform .05s, box-shadow .15s, opacity .15s;
    position: relative;
  }

  /* Card thumbnail — printer photo from data/printers/<brand>_printer_models.json.
     No background or border-radius — the photo renders directly on the card
     surface for a cleaner, less boxed look. */
  .printer-card-thumb {
    position: relative;
    width: 100%;
    height: 110px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    margin-bottom: 4px;
  }
  .printer-card-thumb img {
    max-width: 100%; max-height: 100%;
    width: auto; height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
  }
  /* ── Drag handle (left edge of every card) ────────────────────────── */


  /* ── Drag-to-reorder ("make room") ────────────────────────────────────
     Cards slide (2D translate) to open the drop gap; the dragged card is
     hidden (the OS drag image follows the cursor). Slide transition is set
     inline in JS. */
  .printer-card--dragging { opacity: 0; }
  .mr-reordering .printer-card, .mr-reordering .cam-wall-card { will-change: transform; }
  .printer-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
  }
  .printer-card--active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 14px rgba(0,0,0,.06);
  }
  .printer-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
  }
  .printer-brand-pill {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
    color: var(--on-accent); background: var(--brand-accent, var(--neutral));
    letter-spacing: .2px;
  }
  .printer-active-badge {
    font-size: 10px; font-weight: 700;
    color: var(--primary-text);
    background: color-mix(in srgb, var(--info) 12%, transparent);
    padding: 2px 8px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .3px;
  }
  .printer-card-name {
    font-size: 15px; font-weight: 600; color: var(--text);
    display: flex; align-items: center; gap: 7px;
  }
  .printer-card-name-txt {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* Status dot left of the title — mirrors the Online badge dot:
     green + glow (pulsing) when online, flat grey when offline. */
  .printer-card-name-dot {
    width: 10.5px; height: 10.5px;
    border-radius: 50%;
    background: var(--neutral);       /* offline — fixed grey */
    flex-shrink: 0;
  }
  /* A cloud machine's status dot IS a cloud — same colour code, same heartbeat,
     different shape. It says how the printer is reached AND whether it answers,
     in one mark instead of two.

     THE GLYPH IS DRAWN BY THE PSEUDO-ELEMENT, not by the element itself, and
     that is the whole trick: masking is applied AFTER filtering, so a glow put
     on a masked element — `box-shadow` or `drop-shadow` alike — is clipped away
     with everything outside the silhouette and never shows. Leaving the element
     unmasked lets it carry the halo, exactly the one the round dot uses, while
     the cloud is painted on top. The icon is the FILLED cloud: masking an
     outline would paint only the outline, giving a hollow ring. */
  .printer-card-name-dot.is-cloud {
    position: relative;
    /* One dimension forced, the other derived — the project rule for anything
       masked, so the glyph can never be squashed. Square, because the halo
       behind it is a circle. */
    height: 13px; width: auto; aspect-ratio: 1;
    border-radius: 50%;
    background: transparent;
    /* No `box-shadow: none` here on purpose: the halo is the shared online
       rule's, so a cloud breathes exactly like a round dot and an offline one
       stays bare, with nothing to keep in step by hand. */
  }
  .printer-card-name-dot.is-cloud::before {
    content: ""; position: absolute; inset: 0;
    background: var(--neutral);
    -webkit-mask-image: url('../../assets/svg/icons/icon_cloud_filled.svg');
            mask-image: url('../../assets/svg/icons/icon_cloud_filled.svg');
    -webkit-mask-size: contain;  mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center;  mask-position: center;
  }
  .printer-card-name-dot.is-cloud.is-online {
    background: transparent;     /* beats the round rule's green fill */
    animation: printer-name-dot-pulse 1.8s ease-in-out 3;   /* then steady: a forever pulse kept the window re-compositing (#66) */
  }
  .printer-card-name-dot.is-cloud.is-online::before { background: var(--success); }

  .printer-card-name-dot.is-online {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
    animation: printer-name-dot-pulse 1.8s ease-in-out 3;   /* then steady: a forever pulse kept the window re-compositing (#66) */
  }
  @keyframes printer-name-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); }
    50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 0%, transparent); }
  }
  .printer-card-model {
    font-size: 12px; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* Job status strip in grid card */
  .printer-card-job {
    margin: 6px 0 2px;
  }
  .printer-card-job--idle {
    margin: 4px 0 2px;
  }
  .printer-card-job-bar {
    height: 4px; background: var(--border); border-radius: 2px;
    overflow: hidden; margin-bottom: 6px;
  }
  .printer-card-job-bar span {
    display: block; height: 100%; background: var(--info);
    border-radius: 2px; transition: width .4s;
  }
  .printer-card-job-info {
    display: flex; justify-content: space-between; align-items: center; gap: 6px;
  }
  .printer-card-job-right {
    font-size: 11px; color: var(--muted); font-weight: 500; flex-shrink: 0;
  }
  .printer-card-job-file {
    margin-top: 3px; font-size: 10px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Compact modifier — scales the snap-job-state pill down for card/table contexts */
  .snap-job-state--compact {
    font-size: 11px;
    padding: 3px 10px;
  }
  .snap-job-state--compact::before {
    width: 7px; height: 7px;
    margin-right: 5px;
  }

  .printer-card-foot {
    margin-top: 4px;
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px;
    font-size: 11px; color: var(--muted);
  }
  .printer-card-conn {
    background: var(--surface-2);
    padding: 2px 8px; border-radius: 6px;
    font-weight: 500;
  }
  .printer-card-updated {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex-shrink: 1; min-width: 0;
  }

  .printers-empty-card {
    margin: 24px auto;
    max-width: 460px;
    padding: 32px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    text-align: center;
  }
  .printers-empty-card .icon {
    background: var(--muted);
    margin-bottom: 4px;
  }
  /* Brand line-up instead of a lone icon: printers stand side by side on a
     shared floor, slightly overlapping, the middle ones a touch larger. */
  .printers-empty-card:has(.printers-empty-lineup) { max-width: 560px; padding-top: 22px; }
  .printers-empty-lineup {
    display: flex; align-items: flex-end; justify-content: center; margin: 0 0 8px; padding-bottom: 6px;
    background: radial-gradient(ellipse 60% 14px at 50% 100%, rgba(0, 0, 0, .35), transparent 70%);
  }
  .printers-empty-lineup img {
    height: 92px; width: auto; margin: 0 -6px; object-fit: contain; user-select: none;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35));
    animation: printers-lineup-in .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 60ms);
  }
  .printers-empty-lineup img:nth-child(3), .printers-empty-lineup img:nth-child(4) { height: 108px; position: relative; z-index: 1; }
  @keyframes printers-lineup-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .printers-empty-lineup img { animation: none; } }
  .printers-empty-title {
    font-size: 16px; font-weight: 600; color: var(--text);
  }
  .printers-empty-sub {
    font-size: 13px; color: var(--muted);
    line-height: 1.5;
  }
  /* Void-drop (drag a spool onto empty rack-view space → un-rack it) is still
     wired, but its whole-view amber glow was REMOVED by request: it fired on
     every dragover of empty space — i.e. constantly while moving a spool from
     one rack to another, passing over the gaps — so the entire card appeared to
     "illuminate near the edge". The class is left inert (no visual); the drop
     itself only fires on a deliberate release in empty space, never mid-move
     (a normal rack-to-rack move ends on a slot, not the void). */

  /* (Custom eject-ghost / receiving-pulse animations removed — the
     void-drop now reuses the existing rp-slot-cascade-out keyframe
     for the source slot and flags the spool with `--just-placed` so
     it bounces in at its new home in the unranked panel, matching
     the existing auto-fill / empty-rack visual language.) */
  .printer-card { cursor: pointer; }

  /* Online / offline indicator — used in both the printer grid card and
     the side-card hero. Three states: is-online (green), is-offline
     (grey), is-checking (amber pulsing while we wait for the first ping). */
  .printer-online {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600;
    color: var(--muted);
    letter-spacing: .2px;
  }
  .printer-online-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
  }
  .printer-online.is-online .printer-online-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
  }
  .printer-online.is-online .printer-online-lbl { color: #15803d; }
  .printer-online.is-offline .printer-online-dot { background: var(--neutral); }
  .printer-online.is-checking .printer-online-dot {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
    animation: snap-pulse 0.8s ease-in-out infinite;
  }
  /* Card variant — same pill look as the sidecard, slightly smaller */
  .printer-online--card {
    font-size: 10px;
    margin-top: 4px;
    padding: 2px 9px;
    background: var(--surface-2);
    border-radius: 999px;
    border: 1px solid var(--border);
  }
  .printer-online--card.is-online {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
  }
  .printer-online--card.is-offline {
    background: var(--surface-2);
  }
  .printer-online--card.is-checking {
    background: rgba(245, 158, 11, .14);
    border-color: rgba(245, 158, 11, .3);
  }
  /* Side-card variant — inside the panel-title next to the pills */
  .printer-online--side {
    font-size: 10px;
    margin: 0;
    padding: 2px 9px;
    background: var(--surface-2);
    border-radius: 999px;
    border: 1px solid var(--border);
  }
  .printer-online--side.is-online {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
  }
  .printer-online--side.is-offline {
    background: var(--surface-2);
  }
  .printer-online--side.is-checking {
    background: rgba(245, 158, 11, .14);
    border-color: rgba(245, 158, 11, .3);
  }

  /* ── Add printer modals (brand picker + form) ───────────────────────── */
  /* Legacy modal-card wrapper — kept for any remaining modal use */
  .pba-card {
    width: min(440px, calc(100vw - 32px));
    max-height: 85vh;
    padding: 0;
    display: flex; flex-direction: column;
    overflow: hidden;
  }

  /* ── Per-brand add-flow modals (choice / scan list / manual form) shown as a
       RIGHT side-card instead of a centred modal, so the whole add-printer flow
       (brand picker → choice → scan/manual) stays a consistent right panel like
       #printerBrandPickerPanel / #printerAddPanel (.detail-panel). The higher-
       specificity selectors beat the base .modal-card centring + scale-pop. */
  .modal-overlay:has(> .modal-card.pba-card) {
    justify-content: flex-end;
    align-items: stretch;
    padding: 8px 0;
    /* Transparent + click-through so the brand picker stays visible AND
       interactive to its LEFT (side-by-side, like group + material). The card
       itself re-enables pointer events. */
    background: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    pointer-events: none;
  }
  .modal-overlay:has(> .modal-card.pba-card) > .modal-card.pba-card { pointer-events: auto; }
  .modal-overlay > .modal-card.pba-card {
    width: min(460px, 92vw);
    max-width: 92vw;
    max-height: 100%;
    margin: 0;
    border-right: none;
    border-radius: 14px 0 0 14px;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1), box-shadow .26s;
  }
  .modal-overlay.open > .modal-card.pba-card {
    transform: translateX(0);
    box-shadow: -8px 0 32px rgba(0,0,0,.18);
  }
  /* During a card→card swap (e.g. choice → scan), keep the OUTGOING card pinned
     in place — visible and on-screen — until the incoming card has slid fully
     over it, so the picker never flashes through. JS adds `.pba-keep` to the
     closing overlay for the duration of the slide. */
  /* …and pinned BEHIND the incoming one. Every overlay shares one z-index, so
     otherwise DOM order decides — and a card declared later in its brand's
     markup (e.g. Bambu's choice card, after the cloud card) stayed on top while
     the new card slid in underneath it. */
  .modal-overlay.pba-keep { opacity: 1; }
  .modal-overlay.pba-behind { z-index: 9998; }
  .modal-overlay.pba-keep > .modal-card.pba-card { transform: translateX(0); }

  /* Side-panel variant — replaces the modal-card for brand picker + add/edit form */
  #printerAddPanel {
    width: min(460px, 92vw);
  }
  /* Brand picker is narrow — it only lists brand names. */
  #printerBrandPickerPanel {
    width: min(280px, 92vw);
  }
  /* Add-material source picker — same component, but each row carries a hint AND
     a tier capsule, so it needs the room the brand list doesn't. Its rows grow
     with the wrapped hint instead of clipping it at the fixed brand-row height. */
  /* z 97 = the bottom of the side-card ladder (reorder 98 › product 99 › group
     and container 100 › material 101 › printer 103/105). The picker has no
     scrim, so it can still be open when a spool or a printer card is opened —
     it is the leftmost card of the cascade and must tuck BEHIND every one of
     them at the seam, never cover one. */
  #matSourcePanel {
    width: min(380px, 92vw);
    z-index: 97;
  }
  /* Catalogue pick (new-chip window → "From the catalogue"): same slot and
     ladder rung as the source picker, which it replaces when it opens. */
  #catalogPickPanel {
    width: 400px; max-width: 95vw;
    z-index: 97;
    display: flex; flex-direction: column;
  }
  /* Upgrade of a spool (openCatalogPick({ upgradeFor })): spool card (101) > picker
     > product card, each tab just above its own card — so the three slide out
     one beneath the other when they close together. */
  body.cpk-upgrade #catalogPickPanel { z-index: 99; }
  body.cpk-upgrade #catalogPickCloseTab { z-index: 100; }
  body.cpk-upgrade #productCardPanel { z-index: 97; }
  body.cpk-upgrade #productCardCloseTab { z-index: 98; }
  /* Search pill then the brand filter on one line — the link grid's layout. */
  .cpk-controls { display: flex; align-items: center; gap: 8px; padding: 6px 22px 12px; }
  .cpk-controls .cpk-search { order: -1; flex: 1; }
  .cpk-controls .csel { flex: 0 0 auto; max-width: 45%; }
  /* The mini colour bars (the views' .rv-hue, thinner): under the search row. */
  .cat-pick-panel .cpk-hue.cpk-hue { display: flex; gap: 8px; padding: 2px 22px 12px; }
  .cpk-hue .rv-hue-bar { --rv-bar-h: 14px; min-width: 0; border-radius: 6px; }
  .cpk-list {
    flex: 1; min-height: 0; overflow: auto; scrollbar-width: none;
    display: flex; flex-direction: column; gap: 6px; padding: 2px 22px 18px;
  }
  .cpk-list::-webkit-scrollbar { display: none; }
  .cpk-row.cpk-row {
    display: flex; align-items: center; justify-content: flex-start; gap: 12px; height: auto;
    padding: 0 10px 0 0; min-height: 66px; overflow: hidden; border-radius: 12px; text-align: left;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    cursor: pointer; transition: border-color .15s, transform .15s;
  }
  .cpk-row.cpk-row:hover { border-color: var(--primary); transform: translateY(-1px); }
  /* The illustration is the row's left column: full height, flush with the
     card's rounded edge (the row clips it), the photo inset on the spool colour
     — the grid card's look, laid on its side. */
  .cpk-row .cv-thumb.cv-thumb--fill { align-self: stretch; width: 66px; border-radius: 0; }
  .cpk-row .cv-thumb--fill .cv-thumb-img { top: 5px; left: 5px; width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 8px; }
  .cpk-row.cpk-row.is-selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface-2)); }
  .cpk-row-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .cpk-row-txt b, .cpk-row-txt small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .cpk-row-txt b { font-size: 13.5px; }
  .cpk-row-txt small { font-size: 12px; color: var(--muted); }
  .cpk-empty { margin: 18px 0; font-size: 13px; color: var(--muted); text-align: center; }
  #matSourcePanel .pba-brand {
    height: auto; min-height: 56px;
    padding: 12px 14px;
  }
  /* Tier pair — under the label, not beside it: side by side they would eat the
     row's width, and on their own line the two rungs read as the pair they are
     (what this entry is now, and what it becomes once burned to a chip). */
  .mat-source-tiers {
    display: flex; align-items: center; gap: 6px;
    margin-top: 7px;
  }
  /* (Snapmaker's scan panel used to be a bespoke `.detail-panel.snap-scan-panel`
     side-panel with its own width + header/footer rules. It now uses the shared
     `.modal-overlay > .pba-card` frame like every other brand's scan, so those
     rules were removed — the pba-card styles below cover it.) */
  .pba-header {
    padding: 18px 22px 6px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
  }
  .pba-title {
    font-size: 16px; font-weight: 600; color: var(--text);
  }
  .pba-sub {
    font-size: 13px; color: var(--muted);
    margin-top: 2px;
  }

  .pba-brands {
    padding: 12px 14px 18px;
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto;
  }
  .pba-brand {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    height: 56px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .12s, background .12s, transform .05s;
    text-align: left;
  }
  .pba-brand:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--info) 4%, transparent);
  }
  .pba-brand:active { transform: scale(.99); }
  /* The brand whose add-card is currently open is highlighted in the picker. */
  .pba-brand--selected,
  .pba-brand--selected:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, transparent);
    box-shadow: inset 3px 0 0 var(--primary);
  }
  .pba-brand-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(0,0,0,.04);
  }
  /* Add-mode rows (Scan / Manual IP / Cloud) use a real icon instead of a plain
     colour dot — the dot element is reused and masked. `!important` overrides the
     inline background colour on the span. Shared across all brands via the
     consistent button-id suffixes. */
  [id$="ChoiceScan"]      .pba-brand-dot,
  [id$="ChoiceManual"]    .pba-brand-dot,
  [id$="ChoiceImport"]    .pba-brand-dot,
  [id$="ChoiceCatalogue"] .pba-brand-dot,
  [id$="ChoiceCloud"]     .pba-brand-dot {
    width: 22px; height: 22px;
    border-radius: 0;
    background: var(--primary) !important;
    box-shadow: none;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
  }
  [id$="ChoiceScan"]   .pba-brand-dot { -webkit-mask-image: url('../../assets/svg/icons/icon_wifi.svg');    mask-image: url('../../assets/svg/icons/icon_wifi.svg'); }
  [id$="ChoiceManual"] .pba-brand-dot { -webkit-mask-image: url('../../assets/svg/icons/icon_edit.svg');    mask-image: url('../../assets/svg/icons/icon_edit.svg'); }
  [id$="ChoiceCloud"]  .pba-brand-dot { -webkit-mask-image: url('../../assets/svg/icons/icon_cloud.svg');   mask-image: url('../../assets/svg/icons/icon_cloud.svg'); }
  /* "From Catalogue" (add-material picker) — the magnifier the removed top-bar
     button used, so the action keeps the icon users already associate with it. */
  [id$="ChoiceCatalogue"] .pba-brand-dot { -webkit-mask-image: url('../../assets/svg/icons/icon_search.svg'); mask-image: url('../../assets/svg/icons/icon_search.svg'); }
  /* "Import from Anycubic Slicer" uses the same cube as the 3D Files button. */
  [id$="ChoiceImport"] .pba-brand-dot { -webkit-mask-image: url('../../assets/svg/icons/icon_package.svg'); mask-image: url('../../assets/svg/icons/icon_package.svg'); }
  /* Brand logo (replaces the colour dot) — single-path SVG masked + tinted with
     the brand's OWN colour (set per brand below). mask-size:contain keeps each
     logo's own aspect ratio inside the square box, so no distortion. Black
     wordmark brands (Creality / FlashForge / Snapmaker) use var(--text) so they
     read black in light mode and stay visible (white) in dark mode. */
  /* Shared mask props — brand-picker logo (.pba-brand-logo) + the logo overlaid
     on the printer-table thumbnail (.pt-thumb-logo). */
  .pba-brand-logo, .pt-thumb-logo {
    flex-shrink: 0;
    background-color: var(--text);
    -webkit-mask-size: contain;    mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center;  mask-position: center;
  }
  .pba-brand-logo { width: 26px; height: 26px; }
  .pt-thumb-logo  { width: 14px; height: 13px; }
  /* GRID: white chip pinned to the card thumbnail's top-left corner; logo ~2×. */
  .pt-thumb-badge {
    position: absolute; top: 4px; left: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 9px;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  }
  .pt-thumb-badge .pt-thumb-logo { width: 28px; height: 26px; }
  /* TABLE: brand logo lives in its own column before the printer image. */
  .pt-th--brandlogo { width: 34px; }
  .pt-td--brandlogo { width: 34px; padding: 6px 4px 6px 12px; text-align: center; }
  .pt-td--brandlogo .pt-thumb-logo { display: inline-block; vertical-align: middle; width: 26px; height: 22px; }
  .pba-brand-logo[data-brand="anycubic"],   .pt-thumb-logo[data-brand="anycubic"]   { background-color: #00a9e0; -webkit-mask-image: url('../../assets/svg/icons/logo_anycubic.svg');   mask-image: url('../../assets/svg/icons/logo_anycubic.svg'); }
  .pba-brand-logo[data-brand="bambulab"],    .pt-thumb-logo[data-brand="bambulab"]    { background-color: #00ae42; -webkit-mask-image: url('../../assets/svg/icons/logo_bambulab.svg');   mask-image: url('../../assets/svg/icons/logo_bambulab.svg'); }
  .pba-brand-logo[data-brand="creality"],    .pt-thumb-logo[data-brand="creality"]    { background-color: #2ee65c; -webkit-mask-image: url('../../assets/svg/icons/logo_creality.svg');   mask-image: url('../../assets/svg/icons/logo_creality.svg'); }
  .pba-brand-logo[data-brand="elegoo"],      .pt-thumb-logo[data-brand="elegoo"]      { background-color: #1f4ed8; -webkit-mask-image: url('../../assets/svg/icons/logo_elegoo.svg');     mask-image: url('../../assets/svg/icons/logo_elegoo.svg'); }
  .pba-brand-logo[data-brand="flashforge"],  .pt-thumb-logo[data-brand="flashforge"]  { background-color: var(--text); -webkit-mask-image: url('../../assets/svg/icons/logo_flashforge.svg'); mask-image: url('../../assets/svg/icons/logo_flashforge.svg'); }
  .pba-brand-logo[data-brand="prusa"],       .pt-thumb-logo[data-brand="prusa"]       { background-color: #fa6831; -webkit-mask-image: url('../../assets/svg/icons/logo_prusa.svg'); mask-image: url('../../assets/svg/icons/logo_prusa.svg'); }
  .pba-brand-logo[data-brand="snapmaker"],   .pt-thumb-logo[data-brand="snapmaker"]   { background-color: var(--text); -webkit-mask-image: url('../../assets/svg/icons/logo_snapmaker.svg');  mask-image: url('../../assets/svg/icons/logo_snapmaker.svg'); }
  .pba-brand-text {
    display: flex; flex-direction: column;
    flex: 1; min-width: 0;
  }
  .pba-brand-label {
    font-size: 14px; font-weight: 600; color: var(--text);
  }
  /* When a label carries a "Recommended" badge, lay the text + pill on one row. */
  .pba-brand-label:has(.pba-brand-badge) {
    display: inline-flex; align-items: center; gap: 7px;
  }
  .pba-brand-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--primary); color: var(--on-accent);
    font-size: 10px; font-weight: 700; line-height: 1.5;
    letter-spacing: .02em; text-transform: uppercase;
    white-space: nowrap;
  }
  .pba-brand-conn {
    font-size: 12px; color: var(--muted);
  }
  .pba-brand-chev {
    background: var(--muted);
    flex-shrink: 0;
  }
  .pba-brand:hover .pba-brand-chev { background: var(--primary); }

  .pba-body {
    flex: 1;
    min-height: 0; /* allows flex child to shrink below content height and scroll */
    padding: 16px 22px;
    display: flex; flex-direction: column; gap: 12px;
    overflow-y: auto;
  }
  .pba-field {
    display: flex; flex-direction: column; gap: 4px;
  }
  .pba-field-label {
    font-size: 12px; font-weight: 500; color: var(--muted);
  }
  .pba-field-req {
    color: var(--danger-text);
    margin-left: 2px;
  }
  .pba-input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .12s, box-shadow .12s;
  }
  .pba-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 15%, transparent);
  }
  .pba-input--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
  }
  /* ── Specificity bump — outrank the global `input[type="text"]` rule
     in 60-modals.css L1354 (specificity 0,1,1). Without this the eye toggle
     would silently flip the secret input between two different sizes
     (36 px / 13 px in `password` mode → 40 px / 14 px in `text` mode) the
     moment the user clicks the show/hide icon — the box would grow and the
     text would jump bigger. The global rule does NOT match
     `input[type="password"]`, hence the asymmetric behaviour.
     Doubling each selector bumps `.pba-input` to 0,2,0 (> 0,1,1) so the
     same dimensions apply in BOTH password and text modes.
     ──────────────────────────────────────────────────────────────────── */
  .pba-input.pba-input            { height: 36px; padding: 0 12px; font-size: 13px; }
  .pba-input.pba-input--mono      { font-size: 12px; }
  select.pba-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
  }
  .pba-error {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger-hover);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
  }

  .pba-footer {
    padding: 12px 18px 18px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; gap: 10px;
    flex-shrink: 0;
  }
  .pba-footer .adf-btn--primary { flex: 1; }
  .pba-footer .pba-brand-tuto-link { align-self: center; margin-left: auto; }

  /* ── Add-printer choice cards — consistent header bar ───────────────────────
     Every per-brand choice card shows the SAME top bar: a Back button on the left
     and a "Connection tutorial" button on the right. Brands without a tutorial
     (Anycubic / Creality / Snapmaker) still show the tutorial button — just
     disabled + greyed (see `.pba-brand-tuto-link:disabled` in 60-modals.css). The
     ✕ buttons stay hidden (the `»` close tab + the always-visible brand picker
     handle closing), and the redundant card title/subtitle header is dropped. */
  .pba-card .modal-close      { display: none; }       /* ✕ on choice / scan / manual */
  #printerBrandPickerClose    { display: none; }       /* ✕ on the brand picker */
  /* Drop the whole choice-card header (title "Ajouter une imprimante <Brand>" +
     the already-removed subtitle) — the highlighted brand in the picker beside
     it is enough context. Targets only choice cards via their *AddChoiceTitle. */
  .pba-header:has([data-i18n$="AddChoiceTitle"]) { display: none; }
  /* The footer (Back + tutorial) moves to the TOP of the card and reads as a
     header bar: Back left, tutorial right. */
  .pba-card:has([data-i18n$="AddChoiceTitle"]) .pba-footer {
    order: -1;
    border-top: none;
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    padding: 14px 18px;
  }
  .pba-card:has([data-i18n$="AddChoiceTitle"]) .pba-footer .pba-brand-tuto-link {
    margin: 0;
    font-size: 13px;
    padding: 8px 18px;
  }

  /* ── Choice-card normalization ───────────────────────────────────────────────
     The six per-brand choice cards (Anycubic lists 4 options, the others 2) must
     look identical no matter how each brand authors its markup. Width, frame and
     option-row geometry already come from the shared `.pba-card` / `.pba-brand`
     rules above; these last touches force the few things a brand could still
     drift on, so the cards stay uniform without any per-brand CSS. */
  /* Leading option icon — every brand now uses the masked `.pba-brand-dot` (sized
     by the `[id$="Choice…"]` rules above). This catches any brand that instead
     drops a raw `.icon` span in first, forcing the same 22px primary-tinted mark
     so the column never looks off between brands. */
  .pba-card:has([data-i18n$="AddChoiceTitle"]) .pba-brand > .icon:first-child {
    width: 22px; height: 22px;
    background-color: var(--primary);
  }

  /* ── Custom model picker (image + name) ───────────────────────────── */
  .pba-modelpicker {
    position: relative;
  }
  .pba-mp-trigger {
    width: 100%;
    height: 44px;
    padding: 4px 8px 4px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: border-color .12s, box-shadow .12s, background .12s;
    text-align: left;
  }
  .pba-mp-trigger:hover { border-color: var(--primary); }
  .pba-mp-trigger:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 15%, transparent); }
  .pba-mp-trigger--open { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 15%, transparent); }
  .pba-mp-trigger-text {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .pba-mp-chev {
    background: var(--muted);
    flex-shrink: 0;
    transition: transform .15s;
  }
  .pba-mp-trigger--open .pba-mp-chev { transform: rotate(90deg); background: var(--primary); }

  .pba-mp-thumb {
    width: 36px; height: 36px;
    border-radius: 6px;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }
  .pba-mp-thumb img {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
  }
  .pba-mp-thumb--trigger { width: 32px; height: 32px; }
  .pba-mp-thumb--trigger:empty {
    background: var(--surface-2);
    background-image: linear-gradient(135deg, transparent 45%, var(--border) 45%, var(--border) 55%, transparent 55%);
  }

  .pba-mp-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    max-height: 280px;
    overflow-y: auto;
    z-index: 10;
    padding: 4px;
    display: flex; flex-direction: column; gap: 2px;
  }
  .pba-mp-list[hidden] { display: none; }
  /* Scrolls without a visible bar — the list is short-lived and the search field
     is the fast way through a long catalogue. */
  .pba-mp-list { scrollbar-width: none; }
  .pba-mp-list::-webkit-scrollbar { display: none; }
  .pba-mp-search-row {
    position: sticky; top: -4px; z-index: 1; margin: -4px -4px 2px; padding: 8px 10px;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .pba-mp-search-row .icon { background: var(--muted); flex-shrink: 0; }
  .pba-mp-search-row .pba-mp-search {
    flex: 1; min-width: 0; border: none; outline: none; background: transparent;
    color: var(--text); font-size: 13px; padding: 2px 0;
  }
  .pba-mp-search-row .pba-mp-search:focus,
  .pba-mp-search-row .pba-mp-search:hover { border: none; background: transparent; box-shadow: none; outline: none; }
  .pba-mp-opt[hidden] { display: none; }
  .pba-mp-empty { padding: 12px 10px; font-size: 12px; color: var(--muted); text-align: center; }

  /* "Which printer is it?" — a connector's models embedded in its add-flow choice
     card (printers/model-list.js, Klipper + OctoPrint). Takes the room left
     between the choices and the footer; the list scrolls, the search stays put. */
  .pba-models { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 8px; }
  .pba-card:has(.pba-models:not(:empty)) .pba-brands { flex-shrink: 0; padding-bottom: 6px; }
  .pba-models:empty { display: none; }
  .pba-models-head { display: flex; flex-direction: column; gap: 2px; margin: 6px 2px 8px; }
  .pba-models-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .pba-models-hint { font-size: 12px; color: var(--faint); }
  .pba-models .pba-models-search {
    position: static; margin: 0 0 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2);
  }
  .pba-models .pba-models-search .pba-mp-search { background: transparent; min-height: 0; height: 30px; }
  .pba-models-list {
    flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
    scrollbar-width: none;
  }
  .pba-models-list::-webkit-scrollbar { display: none; }
  .pba-models-check { margin-left: auto; background: var(--primary); opacity: 0; transition: opacity .15s; flex-shrink: 0; }
  .pba-mp-opt--selected { background: color-mix(in srgb, var(--primary) 12%, transparent); }
  .pba-mp-opt--selected:hover { background: color-mix(in srgb, var(--primary) 16%, transparent); }
  .pba-mp-opt--selected .pba-models-check { opacity: 1; }
  .pba-mp-opt {
    width: 100%;
    height: 44px;
    padding: 4px 8px 4px 6px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: background .12s;
  }
  .pba-mp-opt:hover { background: var(--surface-2); }
  .pba-mp-opt:active { background: color-mix(in srgb, var(--info) 8%, transparent); }
  .pba-mp-opt .pba-mp-name {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
  }

  /* ── Password input + eye toggle (used in the add-printer form) ───── */
  .pba-input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
  }
  .pba-input-wrap .pba-input {
    flex: 1;
    padding-right: 38px;
  }
  .pba-input-eye {
    position: absolute;
    top: 50%; right: 4px;
    transform: translateY(-50%);
    width: 30px; height: 30px;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted);
    transition: background .12s, color .12s;
  }
  .pba-input-eye:hover { background: var(--surface-2); color: var(--text); }
  .pba-input-eye .icon { background: currentColor; }
  .pba-input-eye--on { color: var(--primary-text); }
  /* No :active transform hack needed any more — global press feedback is now
     `filter: brightness` (70-detail-misc.css), which can't disturb the eye's
     centering transform. The icon stays put on click; it just darkens. */

  /* ── Eye icon stack — both eye-on + eye-off pre-rendered, swap by
     opacity so toggling the password visibility never reflows the icon's
     position. The two icons are stacked at the same coordinates inside
     a fixed 14×14 grid cell. ────────────────────────────────────────── */
  .pba-eye-stack {
    position: relative;
    width: 14px; height: 14px;
    display: inline-block;
    flex-shrink: 0;
  }
  .pba-eye-icon {
    position: absolute;
    top: 0; left: 0;
    width: 14px; height: 14px;
    transition: opacity .12s;
    pointer-events: none;
  }
  /* Default state (password hidden): show eye-on, hide eye-off */
  .pba-input-eye .pba-eye-icon--off { opacity: 0; }
  .pba-input-eye .pba-eye-icon--on  { opacity: 1; }
  /* Revealed state (password visible): swap */
  .pba-input-eye.pba-input-eye--on .pba-eye-icon--off { opacity: 1; }
  .pba-input-eye.pba-input-eye--on .pba-eye-icon--on  { opacity: 0; }

  /* ── Per-brand helper banner (above the form fields) ──────────────── */
  .pba-helper {
    background: linear-gradient(180deg, color-mix(in srgb, var(--brand-accent, var(--neutral)) 8%, transparent), transparent 60%);
    border: 1px solid color-mix(in srgb, var(--brand-accent, var(--neutral)) 20%, var(--border));
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .pba-helper-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
  }
  .pba-helper-dot {
    width: 8px; height: 8px;
    background: var(--brand-accent, var(--neutral));
    border-radius: 50%;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent, var(--neutral)) 18%, transparent);
  }
  .pba-helper-title {
    font-size: 12px; font-weight: 700;
    color: var(--text);
    text-transform: uppercase; letter-spacing: .6px;
  }
  .pba-helper-list {
    margin: 0; padding-left: 22px;
    display: flex; flex-direction: column; gap: 4px;
    color: var(--muted);
    font-size: 12px; line-height: 1.5;
  }
  .pba-helper-list li::marker {
    color: var(--brand-accent, var(--neutral));
    font-weight: 700;
  }
  .pba-helper-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--brand-accent, var(--primary));
    text-decoration: none;
    font-weight: 500;
  }
  .pba-helper-link:hover { text-decoration: underline; }

  /* "Tutoriel de connexion" pill rendered at the top of the printer
     settings form (Bambu / FlashForge / Elegoo). Same visual language as
     the matching pill in the Add Printer brand picker. Click is routed by
     the global [data-printer-tuto] delegate in inventory.js. */
  .pba-tuto-pill {
    display: inline-flex; align-items: center; gap: 4px;
    align-self: flex-start;
    margin: 0 0 4px;
    padding: 6px 14px;
    background: var(--primary-soft); color: var(--primary-text);
    border: none; border-radius: 999px;
    font-size: 12px; font-weight: 700; line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
  }
  .pba-tuto-pill:hover,
  .pba-tuto-pill:focus-visible {
    background: var(--primary); color: var(--on-accent); outline: none;
  }

  /* ── Sections inside the add form ─────────────────────────────────── */
  .pba-section {
    display: flex; flex-direction: column; gap: 10px;
    padding-top: 6px;
  }
  /* Adjacent sections — keep some breathing room with padding/margin, but
     NO horizontal divider line: the form blocks (identity, connection,
     credentials) are all part of the same connection setup and should
     read as one continuous form, not as separate cards. */
  .pba-section + .pba-section {
    padding-top: 14px;
    margin-top: 4px;
  }
  .pba-section-head {
    font-size: 11px; font-weight: 700;
    color: var(--muted);
    text-transform: uppercase; letter-spacing: .8px;
    padding-bottom: 2px;
  }

  /* Per-field hint shown right under the input. */
  .pba-field-hint {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.4;
    margin-top: 2px;
  }

  /* "(optional)" suffix on optional fields */
  .pba-field-opt {
    font-size: 10px; font-weight: 500;
    color: var(--muted);
    text-transform: uppercase; letter-spacing: .4px;
    margin-left: 4px;
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 4px;
  }

  /* ── Snapmaker discovery modals (choice / scan / manual) ──────────────
     All three reuse .pba-card so they share the modal frame, header and
     footer with the brand picker. Only the body content + a couple of
     bespoke widgets (scan progress bar, candidate cards) are new. */

  /* (Choice modal removed — brand-pick Snapmaker now opens the scan
     panel directly. The .snap-add-choice* rules previously here are
     deleted along with the unused HTML/JS.) */

  /* Scan modal — progress bar on top, results below, empty state when
     nothing yet found. Body scrolls; header + footer stay pinned. */
  .snap-scan-body {
    /* In the side-panel layout the body fills available height between
       the panel header and the footer. `flex: 1` claims the remaining
       space inside the column-flex panel, `min-height: 0` lets it
       shrink below its intrinsic content size so the inner scroll
       actually engages instead of pushing the footer off-screen. */
    flex: 1;
    min-height: 0;
    padding: 14px 18px 14px;
    display: flex; flex-direction: column; gap: 12px;
    overflow-y: auto;
  }
  /* Prevent flex children from shrinking below their natural height —
     without this, when the cumulative content exceeds the body's
     max-height, every direct child gets squeezed (default flex-shrink:1)
     instead of overflowing into the scrollbar. The visible symptom was
     scan cards rendering at 70px while their content needed 100px,
     spilling the thumbnail past the bottom border. */
  .snap-scan-body > * { flex-shrink: 0; }
  /* Bambu Lab cloud sign-in — one field and one key per line. The code row is
     hidden until a code has actually been sent, so the panel opens asking a
     single question instead of showing a form with a field you cannot yet fill. */
  /* Field, then key beneath it — the same shape the add-by-IP panel uses, and
     the field gets the full width it needs for an email address. */
  .bbl-cloud-form {
    display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  }
  /* `display: flex` on a CLASS outranks the `display: none` the browser gives
     [hidden], so without this the second step showed alongside the first — both
     questions asked at once, one of them unanswerable. */
  .bbl-cloud-form[hidden] { display: none; }
  /* The shared input carries `flex: 1`, meant for the row it was written for.
     In a COLUMN the main axis is vertical, so that grow/basis pair governs the
     HEIGHT and quietly discards its own 36px — the field came out squashed. Held
     to its natural height, it is the same field as everywhere else. */
  .bbl-cloud-form .bbl-cloud-input { flex: 0 0 auto; width: 100%; min-width: 0; }
  .bbl-cloud-form .adf-btn { width: 100%; justify-content: center; }
  /* Which Bambu platform: Global or China mainland — two separate account
     worlds, so it is asked before the account, under a heading of its own.
     The chosen half is tinted in the accent and ringed in it: a grey tint was
     lost against the dark card. The frame and the divider belong to the
     CONTAINER, so the ring is drawn inside each half (inset shadow) and never
     fights a neighbour's border for the shared edge. */
  .bbl-cloud-region-row { display: flex; flex-direction: column; gap: 8px; }
  .bbl-cloud-region-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
  .bbl-cloud-region {
    display: flex; overflow: hidden;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface);
  }
  .bbl-cloud-region-opt {
    flex: 1 1 0; min-width: 0; height: 32px; padding: 0 12px;
    border: none; background: none; border-radius: 0;
    color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
  }
  .bbl-cloud-region-opt + .bbl-cloud-region-opt { box-shadow: inset 1px 0 0 var(--border); }
  .bbl-cloud-region-opt:not(.is-active):hover { color: var(--text); background: var(--surface-2); }
  .bbl-cloud-region-opt.is-active,
  .bbl-cloud-region-opt + .bbl-cloud-region-opt.is-active {
    background: color-mix(in srgb, var(--primary) 18%, var(--surface));
    box-shadow: inset 0 0 0 1.5px var(--primary);
    color: var(--text); font-weight: 600;
  }
  .bbl-cloud-region-opt.is-active:first-child { border-radius: 7px 0 0 7px; }
  .bbl-cloud-region-opt.is-active:last-child  { border-radius: 0 7px 7px 0; }
  /* Step 2's reminder of the address the code went to, and the way back to
     step 1 — a typo in the email is the commonest reason a code never arrives. */
  .bbl-cloud-sent {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 12px; color: var(--muted);
  }
  .bbl-cloud-sent[hidden] { display: none; }
  .bbl-cloud-sent-addr { color: var(--text); overflow-wrap: anywhere; }
  .bbl-cloud-change {
    background: none; border: none; padding: 0;
    color: var(--primary-text); font: inherit; cursor: pointer;
    text-decoration: underline; flex-shrink: 0;
  }

  .bbl-cloud-note {
    font-size: 12px; line-height: 1.45;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
  }
  .bbl-cloud-form .bbl-cloud-input.is-invalid { border-color: var(--danger); }
  .bbl-cloud-note.is-error { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
  .bbl-cloud-pick {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted);
  }
  .bbl-cloud-device.is-busy { opacity: .55; pointer-events: none; }
  /* `.adf-btn` is `display: inline-flex`, and a class outranks the `display:
     none` the browser gives [hidden] — so the key stayed on screen with nothing
     ticked. Third time this trap has been sprung in this panel. */
  #bblCloudAddBtn[hidden], .scan-pick-add[hidden] { display: none; }

  /* The tick box, where the scan card puts its chevron: a scan result takes you
     somewhere, this one is picked. Empty outline until chosen, then filled. */
  .bbl-cloud-tick, .scan-pick-tick {
    width: 20px; height: 20px; flex-shrink: 0;
    border: 1.5px solid var(--border); border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: transparent; background: transparent;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
  }
  .bbl-cloud-device.is-picked .bbl-cloud-tick,
  .scan-pick-card.is-picked .scan-pick-tick {
    background: var(--primary); border-color: var(--primary); color: var(--on-accent);
  }
  /* Chosen cards are ringed in the accent, at the offset the storage and printer
     boards use — a selection has to look the same wherever it is made. */
  .bbl-cloud-device.is-picked,
  .scan-pick-card.is-picked {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
  }
  /* A LAN scan result is tickable too (printers/scan-pick.js). When several are
     ticked, a code the scan could not read is asked for on the card itself, on
     its own line under the machine it belongs to. */
  .scan-pick-card { flex-wrap: wrap; }
  .scan-pick-card .scan-pick-tick { align-self: center; }
  .scan-pick-fields {
    flex: 1 0 100%;
    display: flex; flex-direction: column; gap: 8px;
    cursor: default;
  }
  .scan-pick-field { display: flex; flex-direction: column; gap: 4px; }
  .scan-pick-field-lbl { font-size: 11px; color: var(--muted); }
  .scan-pick-field .snap-add-ip-input { flex: 0 0 auto; width: 100%; min-width: 0; }
  .scan-pick-field .snap-add-ip-input.is-mono { font-family: var(--mono, ui-monospace, monospace); }
  .scan-pick-field .snap-add-ip-input.is-missing { border-color: var(--danger); }
  .scan-pick-note { margin-top: 8px; }

  /* Online marker, inline with the name — a machine that is asleep can still be
     added, so this reports a state rather than gating the choice. */
  .bbl-cloud-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--muted); flex-shrink: 0; margin-right: 7px;
  }
  .bbl-cloud-dot.is-online {
    background: var(--success);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
  }

  /* The account's machine list verbatim — debug mode only. */
  .bbl-cloud-raw {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); overflow: hidden;
  }
  .bbl-cloud-raw[hidden] { display: none; }
  .bbl-cloud-raw-head {
    /* The shared copy key is `position: absolute`; without an anchor here it
       climbed to the modal card and floated over the panel's top-right corner. */
    position: relative;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 10px; font-size: 10px; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--border);
  }
  .bbl-cloud-raw-body {
    margin: 0; padding: 10px;
    max-height: 240px; overflow: auto;
    font-family: var(--mono); font-size: 11px; line-height: 1.45;
    color: var(--text); white-space: pre;
  }

  /* Anycubic cloud sign-in — the embedded <webview> fills the card body so the
     official login page reads like a native side-card. Two-class selector beats
     the `.snap-scan-body > *` flex-shrink:0 above so the wrap can actually flex. */
  .acu-cloud-body > .acu-cloud-webview-wrap {
    flex: 1 1 auto; min-height: 420px;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
  }
  .acu-cloud-webview-wrap[hidden] { display: none; }
  .acu-cloud-webview { flex: 1; width: 100%; height: 100%; border: none; }
  .snap-scan-progress {
    display: flex; flex-direction: column; gap: 6px;
  }
  .snap-scan-bar {
    height: 6px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
  }
  .snap-scan-bar > span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width .15s linear;
  }
  .snap-scan-stats {
    font-size: 11px; color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .snap-scan-results {
    display: flex; flex-direction: column; gap: 6px;
    /* Same anti-shrink rule as the body — keeps each candidate card
       at its natural height even when the list grows long. */
  }
  .snap-scan-results > * { flex-shrink: 0; }
  .snap-scan-card {
    /* Apple-style — no border, soft bg, capsule pills inside.
       `align-items: flex-start` anchors every flex child to the TOP
       and lets the row size itself to the tallest child's natural
       height (almost always the main column with 5 stacked text
       lines). No overflow: hidden, no min-height: the card is
       exactly as tall as its content needs. */
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background .14s ease, transform .06s ease;
    text-align: left;
    animation: snap-scan-card-in .25s ease-out;
    flex-shrink: 0;
  }
  .snap-scan-card:hover {
    background: color-mix(in srgb, var(--info) 6%, transparent);
  }
  .snap-scan-card:active { transform: scale(.995); }
  /* Focus ring for keyboard navigation on the role=button div. */
  .snap-scan-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: color-mix(in srgb, var(--info) 6%, transparent);
  }
  /* Loading state — short visual feedback while the Firestore write is
     in flight after a click. Disables further clicks via pointer-events
     and dims the card so the user sees the action registered. */
  .snap-scan-card--loading {
    pointer-events: none;
    opacity: .55;
  }
  /* Model thumbnail — soft surface-2 background, no border. The
     `align-self: flex-start` keeps the thumbnail anchored to the
     top of the card on tall cards (5 lines of text in main column)
     instead of stretching with the row to a 100px-tall thumbnail. */
  .snap-scan-card-thumb {
    width: 56px; height: 56px;
    flex-shrink: 0;
    align-self: flex-start;
    border-radius: 12px;
    background: var(--surface-2);
    border: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .snap-scan-card-thumb img {
    width: 100%; height: 100%;
    object-fit: contain;
    transition: opacity .15s;
  }
  .snap-scan-card-main {
    /* `flex: 1` claims remaining horizontal space; `min-width: 0` lets
       the children's `text-overflow: ellipsis` rules trigger when the
       panel is narrow. Without min-width:0, intrinsic content forces
       the column to grow forever and breaks the card. */
    display: flex; flex-direction: column;
    flex: 1; min-width: 0;
    gap: 3px;
  }
  /* Score + chev anchored to the top so they sit on the title row
     (not vertically centred on a tall multi-line card, which would
     visually stagger them with the IP / model lines). */
  .snap-scan-card-score,
  .snap-scan-card-chev {
    align-self: flex-start;
    margin-top: 2px;
  }
  .snap-scan-card-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    line-height: 22px;             /* matches the badge height so they sit on the same line */
    display: flex; align-items: center; gap: 6px;
    min-width: 0;
  }
  .snap-scan-card-title-text {
    flex: 1 1 auto; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Brand-confirmed badge — Apple-style flat pill, no border. */
  .snap-scan-card-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(155, 89, 182, .14);
    color: #7b3fa3;
    border: 0;
    font-size: 10px; font-weight: 600;
    letter-spacing: .2px;
    line-height: 1.4;
    white-space: nowrap;
  }
  .snap-scan-card-ip {
    font-size: 11px; color: var(--muted);
    font-family: var(--mono);
    line-height: 1.4;
    /* Same truncation pattern as the other identity lines so a long
       IPv6 (one day) wouldn't bleed into the score column. */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
  }
  /* Identity lines below the title:
       --model  → machine_type · firmware version (regular text colour)
       --host   → mDNS hostname (mono, dimmer — secondary detail)
       --sn     → serial number prefixed with "S/N · " (mono, dimmer)
     Each line truncates with ellipsis so a long hostname doesn't break
     the card layout. The full value is in the `title` attribute for
     hover-reveal. */
  .snap-scan-card-line {
    font-size: 11px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.4;
  }
  .snap-scan-card-line--model {
    color: var(--text);
    font-weight: 500;
  }
  .snap-scan-card-line--host,
  .snap-scan-card-line--sn {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--muted);
  }
  /* Legacy single-line sub kept for backwards compatibility — newer
     cards use .snap-scan-card-line instead. */
  .snap-scan-card-sub {
    font-size: 11px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Chevron — softer/dimmer than before. No hover bump-to-primary
     (Apple style keeps directional indicators muted). */
  .snap-scan-card-chev {
    background: var(--border);
    flex-shrink: 0;
    opacity: .9;
  }
  .snap-scan-card:hover .snap-scan-card-chev {
    background: var(--muted);
    opacity: 1;
  }
  /* Match-score pill — flat, borderless. Tinted by confidence tier. */
  .snap-scan-card-score {
    flex-shrink: 0;
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px; font-weight: 600;
    line-height: 22px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: 0;
  }
  .snap-scan-card--high .snap-scan-card-score {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success-hover-text);
  }
  .snap-scan-card--med .snap-scan-card-score {
    background: color-mix(in srgb, var(--warning) 14%, transparent);
    color: var(--warning-hover);
  }
  .snap-scan-card--low {
    opacity: .82;
  }
  .snap-scan-card--low:hover { opacity: 1; }
  @keyframes snap-scan-card-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .snap-scan-empty {
    padding: 14px;
    text-align: center;
    font-size: 12px; color: var(--muted);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 10px;
  }
  /* Variant shown when firewall block detected on user-declared subnets:
     warning palette (amber border, slightly bigger emphasis) so the
     user notices it's NOT the same generic "nothing found" state. */
  .snap-scan-empty--warn {
    color: var(--text);
    background: color-mix(in srgb, var(--warning) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    text-align: left;
    line-height: 1.5;
  }

  /* Add by IP — collapsible direct-probe widget. Default state is just
     the trigger button (saves vertical space when the user is happy
     with the auto-scan). Clicking it expands a vertical body: label →
     input → Validate button → status. Apple-style: borderless,
     just a softer surface against the modal body. */
  .snap-add-ip {
    background: var(--surface);
    border: 0;
    border-radius: 14px;
    overflow: hidden;
  }
  /* Summary acts as the trigger button. Collapsed state shows just an
     "+ Add by IP" row; clicking it expands the body. Same visual
     language as the Extra-subnets summary so the modal feels coherent. */
  .snap-add-ip-summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text);
    user-select: none;
    transition: background .1s;
  }
  .snap-add-ip-summary:hover { background: color-mix(in srgb, var(--info) 4%, transparent); }
  .snap-add-ip-summary::-webkit-details-marker { display: none; }
  .snap-add-ip-summary-icon {
    background: var(--primary);
    flex-shrink: 0;
  }
  .snap-add-ip-summary-label {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .snap-add-ip-chev {
    background: var(--muted);
    flex-shrink: 0;
    transition: transform .15s ease;
  }
  details[open] > .snap-add-ip-summary .snap-add-ip-chev {
    transform: rotate(90deg);
    background: var(--primary);
  }
  /* Body — vertical stack: label → input → Validate → status.
     Apple-style: no top border, just spacing for separation. */
  .snap-add-ip-body {
    padding: 0 14px 14px;
    display: flex; flex-direction: column; gap: 10px;
    padding-top: 4px;
  }
  .snap-add-ip-label {
    font-size: 12px; font-weight: 500;
    color: var(--muted);
  }
  /* Input wrap is `position: relative` so the floating tip can be
     anchored below the field without affecting layout flow. */
  .snap-add-ip-input-wrap {
    width: 100%;
    position: relative;
    display: flex;
  }
  /* Input — Apple-style: filled background, no border, ring on focus. */
  .snap-add-ip-input {
    flex: 1;
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    transition: box-shadow .14s ease, background .12s ease;
  }
  .snap-add-ip-input:focus {
    background: var(--surface);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--info) 35%, transparent);
  }
  /* Invalid state — red border + soft red ring (HTML5-form-style). */
  .snap-add-ip-input--err {
    border-color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 4%, transparent);
  }
  .snap-add-ip-input--err:focus {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 20%, transparent) !important;
  }
  /* Valid state — soft green to confirm format is parseable. */
  .snap-add-ip-input--ok {
    border-color: var(--success-hover) !important;
  }
  /* "Invalid IP address format" bubble — floats to the RIGHT of the
     input (tooltip-style) so it doesn't push down on the Validate
     button below. Aria role=alert so screen readers announce it the
     moment it appears. The triangle points left, into the input. */
  .snap-add-ip-tip {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%);
    padding: 6px 10px;
    background: var(--danger);
    color: var(--on-dark);
    border-radius: 6px;
    font-size: 11px; font-weight: 600;
    line-height: 1.3;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    z-index: 10;
    animation: snap-add-ip-tip-in .12s ease-out;
    white-space: nowrap;
    pointer-events: none;
  }
  .snap-add-ip-tip::before {
    content: "";
    position: absolute;
    top: 50%; left: -4px;
    transform: translateY(-50%) rotate(45deg);
    width: 8px; height: 8px;
    background: var(--danger);
  }
  .snap-add-ip-tip .icon {
    background: var(--surface);
    flex-shrink: 0;
  }
  /* Narrow modal fallback — when the bubble would overflow the modal
     edge, drop it below the field instead of right of it. Triggered
     by a CSS class we can't compute purely in CSS, so we fall back
     to a media query on small viewports. */
  @media (max-width: 520px) {
    .snap-add-ip-tip {
      top: calc(100% + 6px);
      left: 0;
      transform: none;
      white-space: normal;
    }
    .snap-add-ip-tip::before {
      top: -4px; left: 14px;
      transform: rotate(45deg);
    }
  }
  @keyframes snap-add-ip-tip-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  /* Validate button — full width on its own row, sits below the input.
     Uses the existing primary style; we just override the height to
     match the input + add a small top margin so the bubble (which
     appears below the input) has room to float without colliding. */
  .snap-add-ip-btn {
    height: 36px;
    width: 100%;
    margin-top: 2px;
    justify-content: center;
  }
  .snap-add-ip-btn:disabled { opacity: .5; cursor: not-allowed; }
  /* Status row below the input — shows live "Reaching X…" or "No reply"
     after the user hits the button. Same palette as the legacy manual
     modal so the visual language is consistent. */
  .snap-add-ip-status {
    margin-top: 4px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
  }
  .snap-add-ip-status--info {
    background: color-mix(in srgb, var(--info) 8%, transparent);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
  }
  .snap-add-ip-status--err {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  }
  .snap-add-ip-anyway {
    margin-left: auto;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px; font-weight: 600;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
  }
  .snap-add-ip-anyway:hover { background: rgba(0,0,0,.04); }

  /* Extra-subnets widget — collapsible. Apple-style: borderless,
     softer background, larger radius. */
  .snap-extra-subnets {
    background: var(--surface);
    border: 0;
    border-radius: 14px;
    overflow: hidden;
  }
  .snap-extra-subnets-summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text);
    user-select: none;
    transition: background .1s;
  }
  .snap-extra-subnets-summary:hover { background: color-mix(in srgb, var(--info) 4%, transparent); }
  .snap-extra-subnets-summary::-webkit-details-marker { display: none; }
  /* Network icon on the left — gives the row visual identity. */
  .snap-extra-subnets-icon {
    background: var(--muted);
    flex-shrink: 0;
  }
  /* Label takes all remaining space + truncates if the locale is long. */
  .snap-extra-subnets-label {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .snap-extra-subnets-count {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 0;
    color: var(--muted);
    font-size: 10px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
  }
  /* Chevron on the right — rotates 90° when expanded. Replaces the old
     "›" pseudo-element so we get a consistent icon weight with the rest
     of the app. */
  .snap-extra-subnets-chev {
    background: var(--muted);
    flex-shrink: 0;
    transition: transform .15s ease;
  }
  details[open] > .snap-extra-subnets-summary .snap-extra-subnets-chev {
    transform: rotate(90deg);
    background: var(--primary);
  }
  .snap-extra-subnets-body {
    padding: 4px 14px 14px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .snap-extra-subnets-hint {
    font-size: 11px; color: var(--muted);
    line-height: 1.4;
  }
  .snap-extra-subnets-row {
    display: flex; gap: 6px;
  }
  .snap-extra-subnets-input {
    flex: 1;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
    transition: box-shadow .14s ease, background .12s ease;
  }
  .snap-extra-subnets-input:focus {
    background: var(--surface);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--info) 35%, transparent);
  }
  .snap-extra-subnets-add {
    height: 32px;
    padding: 0 16px;
    background: var(--primary);
    color: var(--on-accent);
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: opacity .12s;
  }
  .snap-extra-subnets-add:hover { opacity: .9; }
  .snap-extra-subnets-err {
    font-size: 11px;
    color: var(--danger-text);
    padding: 4px 0;
  }
  .snap-extra-subnets-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
  }
  .snap-extra-subnets-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 4px 4px 12px;
    background: color-mix(in srgb, var(--info) 10%, transparent);
    border: 0;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 11px; font-weight: 600;
    color: var(--text);
  }
  .snap-extra-subnets-chip-text { white-space: nowrap; }
  .snap-extra-subnets-chip-x {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px; line-height: 1;
    font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .1s, color .1s;
  }
  .snap-extra-subnets-chip-x:hover {
    background: color-mix(in srgb, var(--danger) 15%, transparent);
    color: var(--danger-text);
  }

  /* Debug-only scan journal — collapsible panel at the bottom of the
     scan modal. Hidden entirely when state.debugEnabled is false.
     Apple-style: borderless, just a softer background tier. */
  .snap-scan-log {
    margin-top: 8px;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
  }
  .snap-scan-log-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border-bottom: 0;
  }
  /* Toggle + count form a single click target on the LEFT.
     The actions cluster (Export / Clear) sits on the RIGHT with its
     own gap so the buttons never crowd the count badge. */
  .snap-scan-log-toggle {
    display: flex; align-items: center; gap: 8px;
    flex: 1; min-width: 0;
    background: transparent;
    border: 0;
    padding: 2px 0;
    font-family: inherit;
    font-size: 12px; font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: left;
  }
  .snap-scan-log-chev {
    background: var(--muted);
    transition: transform .15s ease;
    flex-shrink: 0;
  }
  .snap-scan-log-toggle--open .snap-scan-log-chev {
    transform: rotate(90deg);
    background: var(--primary);
  }
  .snap-scan-log-title {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .snap-scan-log-count {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 0;
    color: var(--muted);
    font-size: 10px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
  }
  .snap-scan-log-actions {
    display: flex; gap: 4px;
    flex-shrink: 0;
  }
  /* Apple-style icon button — soft surface, no border, hover bg shift. */
  .snap-scan-log-btn {
    background: var(--surface-2);
    border: 0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11px; font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background .12s ease;
  }
  .snap-scan-log-btn--icon { padding: 7px 9px; gap: 0; }
  .snap-scan-log-btn .icon {
    background: var(--muted);
    flex-shrink: 0;
    transition: background .12s;
  }
  .snap-scan-log-btn:hover {
    background: color-mix(in srgb, var(--info) 10%, transparent);
  }
  .snap-scan-log-btn:hover .icon { background: var(--text); }
  /* Clear button — hovers red, destructive cue. */
  #snapScanLogClear:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
  #snapScanLogClear:hover .icon { background: var(--danger); }
  /* Icon next to "Scan log" title — same colour treatment as the chevron. */
  .snap-scan-log-title-icon {
    background: var(--muted);
    flex-shrink: 0;
  }
  .snap-scan-log-toggle--open .snap-scan-log-title-icon { background: var(--primary); }
  .snap-scan-log-btn:hover {
    color: var(--text);
    border-color: var(--primary);
  }
  /* Primary variant — used by Export. Stands out so the user notices
     the action is "do something with the data" rather than "wipe it". */
  .snap-scan-log-btn--primary {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
  }
  .snap-scan-log-btn--primary:hover {
    color: var(--on-accent);
    background: var(--primary);
    border-color: var(--primary);
  }
  /* Transient feedback states after Export click. */
  .snap-scan-log-btn--ok {
    color: var(--success-hover-text) !important;
    border-color: var(--success-hover) !important;
    background: color-mix(in srgb, var(--success) 12%, transparent) !important;
  }
  .snap-scan-log-btn--err {
    color: var(--danger-text) !important;
    border-color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 12%, transparent) !important;
  }
  .snap-scan-log-body {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.4;
  }
  .snap-scan-log-row {
    display: grid;
    grid-template-columns: 78px 70px 1fr;
    gap: 8px;
    width: 100%;
    padding: 3px 10px;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    transition: background .08s;
  }
  .snap-scan-log-row:hover:not(:disabled) { background: color-mix(in srgb, var(--info) 6%, transparent); }
  .snap-scan-log-row:disabled { cursor: default; opacity: .75; }
  .snap-scan-log-row--copied { background: color-mix(in srgb, var(--success) 14%, transparent) !important; }
  .snap-scan-log-ts { color: var(--muted); font-variant-numeric: tabular-nums; }
  .snap-scan-log-kind {
    text-transform: uppercase;
    font-weight: 700;
    font-size: 10px;
    align-self: center;
    color: var(--muted);
  }
  .snap-scan-log-row--hit       .snap-scan-log-kind { color: var(--success-hover-text); }
  .snap-scan-log-row--ambiguous .snap-scan-log-kind { color: var(--warning-hover); }
  .snap-scan-log-row--error     .snap-scan-log-kind { color: var(--danger-text); }
  .snap-scan-log-summary {
    color: var(--text);
    word-break: break-all;
  }

  /* Manual modal — single IP input + status banner. Status flips between
     info (during probe) and err (no reply / bad IP). */
  .snap-manual-status {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
  }
  .snap-manual-status--info {
    background: color-mix(in srgb, var(--info) 8%, transparent);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
  }
  .snap-manual-status--err {
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  }
  .snap-manual-anyway {
    margin-left: auto;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px; font-weight: 600;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
  }
  .snap-manual-anyway:hover { background: rgba(0,0,0,.04); }

  /* ── Printer detail panel (slide-in from right) ──────────────────────── */
  #printerPanel { width: min(440px, 92vw); }

  /* Scroll wrapper: camera + body scroll together as one unit */
  .pp-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Scrolls without a visible bar — same as the material card (#panelBody). */
    scrollbar-width: none;
  }
  .pp-scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }
  /* The body must NOT scroll on its own: the generic `.panel-body` rule
     (70-detail-misc.css, loaded later) gives it `overflow-y: auto` + `flex: 1`,
     which turned it into a second scroller — so the Snapmaker camera, which sits
     above it in #ppPersistentCam, stayed pinned while the rest scrolled under it.
     Doubled id selector to outrank that rule without !important. It still grows
     to fill a short panel, but never shrinks below its content. */
  #printerPanelBody#printerPanelBody {
    padding: 0 0 24px;
    display: flex; flex-direction: column;
    flex: 1 0 auto;
    overflow: visible;
  }

  /* Hero — printer photo (or fallback when camera is off). The
     horizontal separator below has been removed: the next section
     (live block, raw section, etc.) provides its own visual gap so
     the hero blends into the body without a hard line.
     Bottom padding reduced — the live block has its own internal
     spacing so we don't need extra room beneath the hero. */
  .pp-hero {
    padding: 18px 20px 0;
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    position: relative;
  }
  /* Pills row above the hero image — brand (filled) + model (outline). */
  .pp-hero-pills {
    display: flex; flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 2px;
  }
  .pp-brand-pill {
    display: inline-flex; align-items: center;
    padding: 3px 12px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
    color: var(--on-accent); background: var(--brand-accent, var(--neutral));
    letter-spacing: .2px;
  }
  /* Model pill — outline-style label sitting next to the brand pill,
     uses the brand accent as the border colour so they read as a pair. */
  .pp-model-pill {
    display: inline-flex; align-items: center;
    padding: 2px 11px;
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    letter-spacing: .2px;
  }
  .pp-active {
    position: absolute; top: 18px; right: 20px;
    font-size: 10px; font-weight: 700;
    color: var(--primary-text);
    background: color-mix(in srgb, var(--info) 12%, transparent);
    padding: 3px 10px; border-radius: 999px;
    text-transform: uppercase; letter-spacing: .3px;
  }
  .pp-hero-img {
    width: 100%;
    height: 180px;
    margin: 8px 0 4px;
    background: var(--surface-2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .pp-hero-img img {
    max-width: 100%; max-height: 100%;
    width: auto; height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
  }
  .pp-hero-name {
    font-size: 20px; font-weight: 600; color: var(--text);
    margin-top: 4px;
    word-break: break-word;
  }
  .pp-hero-model {
    font-size: 13px; color: var(--muted);
  }
  .pp-features {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
  }
  .pp-feature {
    font-size: 11px; font-weight: 500;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: .2px;
  }

  /* Sections */
  .pp-section {
    padding: 12px 20px 14px;
    border-bottom: 1px solid var(--border);
  }
  .pp-section:last-child { border-bottom: none; }
  .pp-section-head {
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .8px;
    padding: 4px 0 10px;
    display: flex; align-items: center; gap: 6px;
  }
  .pp-section-head--btn {
    background: none; border: none; cursor: pointer;
    width: 100%; padding: 4px 0 10px;
    color: var(--muted);
    font-family: inherit;
    text-transform: uppercase; letter-spacing: .8px; font-weight: 700;
    font-size: 11px;
    justify-content: space-between;
    height: auto;
  }
  .pp-section-head--btn:hover { background: none; color: var(--text); }
  .pp-chev { transition: transform .15s; background: currentColor; }
  .pp-section--collapsible[data-collapsed="false"] .pp-chev { transform: rotate(90deg); }
  .pp-section--collapsible[data-collapsed="true"] .pp-section-body { display: none; }

  /* Rows */
  .pp-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    min-height: 28px;
  }
  .pp-row-lbl {
    color: var(--muted);
    flex-shrink: 0;
  }
  .pp-row-val {
    color: var(--text);
    text-align: right;
    overflow: hidden; text-overflow: ellipsis;
    display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end;
    min-width: 0;
    word-break: break-all;
  }
  .pp-row-val--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
  }

  /* Editable cell — pencil hint + click-to-edit + inline input.
     The pencil sits at the right of the value; the entire cell is the
     hit target so users can click anywhere on the value to edit. */
  .pp-row--editable .pp-row-val--editable {
    cursor: text;
    border-radius: 6px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background .12s, box-shadow .12s;
    outline: none;
  }
  .pp-row--editable .pp-row-val--editable:hover {
    background: var(--surface-2);
  }
  .pp-row--editable .pp-row-val--editable:focus-visible {
    box-shadow: 0 0 0 2px var(--primary);
  }
  .pp-pencil {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    opacity: 0;
    transition: opacity .12s;
    flex-shrink: 0;
  }
  .pp-pencil .icon { background: var(--muted); }
  .pp-row-val--editable:hover .pp-pencil { opacity: 1; }
  .pp-row-val--editable:focus-visible .pp-pencil { opacity: 1; }

  /* Hero printerName — bigger hover target, pencil also reveals on hover */
  .pp-hero-name.pp-row-val--editable {
    cursor: text;
    border-radius: 8px;
    padding: 2px 6px;
    margin: 4px -6px 0;
    display: inline-flex; align-items: center; gap: 8px;
    transition: background .12s;
  }
  .pp-hero-name.pp-row-val--editable:hover { background: var(--surface-2); }
  .pp-hero-name.pp-row-val--editable .pp-pencil { width: 18px; height: 18px; }
  .pp-hero-name.pp-row-val--editable .pp-pencil .icon { width: 14px; height: 14px; }

  /* Inline edit input — replaces the cell content */
  .pp-edit-input {
    flex: 1; min-width: 0;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 15%, transparent);
  }
  .pp-row-val--editing { padding: 0 !important; margin: 0 !important; }
  .pp-row-val--saving {
    color: var(--muted);
    font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end;
  }
  .pp-edit-spin {
    width: 12px; height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    display: inline-block;
  }
  .pp-edit-error {
    color: var(--danger-hover);
    font-size: 12px;
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    padding: 2px 8px;
    border-radius: 6px;
  }

  /* Inline copy + eye buttons */
  .pp-copy, .pp-eye {
    background: var(--surface-2); border: 1px solid var(--border);
    width: 24px; height: 24px;
    border-radius: 6px;
    padding: 0; margin: 0;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s, transform .05s;
  }
  .pp-copy:hover, .pp-eye:hover { background: var(--surface); color: var(--text); }
  .pp-copy:active, .pp-eye:active { transform: scale(0.94); }
  .pp-copy .icon, .pp-eye .icon { background: var(--muted); }
  .pp-copy:hover .icon, .pp-eye:hover .icon { background: var(--text); }
  .pp-copy--ok { background: var(--primary); border-color: var(--primary); }
  .pp-copy--ok .icon { background: var(--on-accent); }

  /* Sensitive section warning */
  .pp-section--secret {
    background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 4%, transparent), transparent 80%);
  }
  .pp-secret-warn {
    display: flex; align-items: flex-start; gap: 8px;
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger-hover);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px; line-height: 1.45;
    margin-bottom: 10px;
  }
  .pp-secret-warn .icon { background: var(--danger-hover); flex-shrink: 0; margin-top: 1px; }
  .pp-secret { user-select: all; }

  /* Raw JSON */
  .pp-raw-wrap {
    position: relative;
    margin: 4px 0 0;
  }
  .pp-raw {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px 12px 10px;
    font-size: 11px; line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text);
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap; word-break: break-all;
  }
  /* Floating copy button in the top-right of the JSON block.
     Overrides the square .pp-copy inline-row variant: this one is a
     pill with both icon + label, so it's discoverable without hover. */
  .pp-raw-copy.pp-copy {
    position: absolute; top: 8px; right: 8px;
    width: auto; height: 24px;
    padding: 0 10px;
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 500;
    color: var(--muted);
    background: var(--surface);
    z-index: 1;
  }
  .pp-raw-copy.pp-copy:hover { color: var(--text); background: var(--surface); border-color: var(--primary); }
  .pp-raw-copy.pp-copy.pp-copy--ok { color: var(--on-accent); }
  .pp-raw-copy.pp-copy.pp-copy--ok .icon { background: var(--on-accent); }


/* ── Printer setup steps (Snapmaker U1 — expandable cards) ──────────────── */

/* <details> card */
.pba-step {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--surface);
}
.pba-step + .pba-step { margin-top: 6px; }

/* Summary row — always visible */
.pba-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none; /* hide default marker */
}
.pba-step-header::-webkit-details-marker { display: none; }
.pba-step-header:hover { background: var(--ink-04); }

/* Numbered badge */
.pba-step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Title + subtitle stacked */
.pba-step-titles {
  flex: 1;
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.pba-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.pba-step-sub {
  font-size: 11px;
  color: var(--muted);
}

/* Chevron — rotates 90° when open */
.pba-step-chev {
  flex-shrink: 0;
  width: 16px; height: 16px;
  background: var(--muted);
  -webkit-mask-image: url('../../assets/svg/icons/icon_chevron_right.svg');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: transform .2s ease;
}
details[open] .pba-step-chev { transform: rotate(90deg); }

/* Expanded body */
.pba-step-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Description paragraph */
.pba-step-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 10px 0 0;
}
.pba-step-desc strong { color: var(--text); font-weight: 600; }

/* Ordered instruction list */
.pba-step-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pba-step-list strong { color: var(--text); font-weight: 600; }

/* Inline code inside step body */
.pba-step-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
  white-space: nowrap;
}

/* Call-to-action button */
.pba-step-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  align-self: flex-start;
  transition: opacity .15s;
}
.pba-step-cta:hover { opacity: .85; }
.pba-step-cta:active { opacity: .7; }

/* Secondary (outline) variant */
.pba-step-cta--secondary {
  background: transparent;
  color: var(--primary-text);
  border: 1px solid var(--primary);
}
.pba-step-cta--secondary .pba-step-cta-icon {
  background-color: var(--primary);
}
.pba-step-cta--secondary:hover { background: color-mix(in srgb, var(--info) 8%, transparent); opacity: 1; }
.pba-step-cta--secondary:active { background: color-mix(in srgb, var(--info) 15%, transparent); opacity: 1; }

/* Container when two CTAs sit side by side */
.pba-step-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Icon inside CTA button — white mask on colored background */
.pba-step-cta-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  aspect-ratio: 1;
  flex-shrink: 0;
  background-color: var(--surface);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}
.pba-step-cta-icon--github {
  -webkit-mask-image: url('../../assets/svg/icons/icon_github.svg');
}
.pba-step-cta-icon--youtube {
  -webkit-mask-image: url('../../assets/svg/icons/icon_youtube.svg');
}
.pba-step-cta-icon--link {
  -webkit-mask-image: url('../../assets/svg/icons/icon_link.svg');
}
.pba-step-cta-icon--download {
  aspect-ratio: 1;
  -webkit-mask-image: url('../../assets/svg/icons/icon_download.svg');
}
.pba-step-cta-icon--fluid {
  aspect-ratio: 446.6 / 512; /* logo_fluidd.svg viewBox="32.7 0 446.6 512" */
  -webkit-mask-image: url('../../assets/svg/logos/logo_fluidd.svg');
}

.pba-step-cta-icon--img {
  aspect-ratio: 1;
  -webkit-mask-image: url('../../assets/svg/icons/icon_eye_on.svg');
}

/* Buy Me a Coffee — standalone logo link, no button wrapper */
.pba-bmc-link {
  display: inline-block;
  cursor: pointer;
  transition: opacity .15s;
  align-self: flex-start;
}
.pba-bmc-link:hover  { opacity: .85; }
.pba-bmc-link:active { opacity: .7; }
.pba-bmc-link img {
  height: 36px;
  width: auto;
  display: block;
}

/* ── Printer table sub-view ─────────────────────────────────────────────── */
/* Same finish as the inventory `.table-wrap`: the table scrolls inside a
   rounded, bordered box (vertically + horizontally), with the header pinned. */
.pt-wrap {
  flex: 1; min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: var(--view-gap);
  scrollbar-width: none;   /* hide the scrollbar (still scrolls) */
}
.pt-wrap::-webkit-scrollbar { width: 0; height: 0; }
.pt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
/* z-index 20, matching the inventory table's own thead: it must sit ABOVE the
   row selection checkboxes (`.sel-check` is z-index 4), otherwise a row
   scrolling under the sticky header shows its checkbox on top of it. */
.pt-head { position: sticky; top: 0; background: var(--surface-2); z-index: 20; }
.pt-th { padding: 9px 12px; text-align: left; font-size: 12px; font-weight: 600;
         text-transform: uppercase; letter-spacing: .03em;
         color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.pt-th--sort { cursor: pointer; user-select: none; }
.pt-th--sort:hover { color: var(--text); }
.pt-th--sort::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 11px; height: 11px; margin-left: 5px;
  background-color: currentColor; opacity: .3;
  -webkit-mask-image: url('../../assets/svg/icons/icon_chevron_right.svg');
  mask-image: url('../../assets/svg/icons/icon_chevron_right.svg');
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  transform: rotate(90deg);
  transition: transform .15s, opacity .15s, background-color .15s;
}
.pt-th--sort.sort-asc::after  { opacity: 1; background-color: var(--primary); transform: rotate(-90deg); }
.pt-th--sort.sort-desc::after { opacity: 1; background-color: var(--primary); transform: rotate(90deg); }
.pt-td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pt-row:last-child .pt-td { border-bottom: none; }
.pt-td--ip code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pt-td--name { font-weight: 500; }
.pt-row:hover { background: var(--surface-2); }
.pt-row:active { background: var(--surface-2); }
.pt-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
          background: var(--neutral); margin-right: 5px; vertical-align: middle; }
.pt-dot--on { background: var(--success); }
.pt-th--thumb { width: 56px; padding: 8px 8px 8px 12px; }
.pt-td--thumb { width: 56px; padding: 6px 8px 6px 12px; }
/* No blend mode here: every printer photo in assets/img/<brand>_printers/ is a
   real transparent PNG, so nothing needs to be knocked out — and `multiply`
   against a dark row background turned each printer into a black silhouette
   (permanently on Windows, on :hover only on macOS, where the row background is
   painted at different times). Keep it plain. */
.pt-thumb { display: block; width: 44px; height: 44px; object-fit: contain;
            border-radius: 4px; }
/* Print-preview thumbnail column — the current job's model preview, so you can
   see what's on the bed at a glance. Empty (no box) when idle / unavailable. */
.pt-th--jobthumb, .pt-td--jobthumb { width: 64px; white-space: nowrap; }
/* Tight padding on BOTH the header and the cell so the column collapses to the
   preview width — the header's default 12px side padding was what kept the
   column wide and left dead space around the thumbnail. */
.pt-th--jobthumb { padding: 9px 12px; }   /* left-aligned like the other headers */
/* Breathing room around the preview so it never touches the row's top/bottom
   edges. A finished job (no progress bar / % / filename) makes a shorter row, so
   without this the fixed 60px thumbnail nearly fills the short row while it sits
   comfortably inset on taller "printing" rows — this keeps the margin consistent. */
.pt-td--jobthumb { padding: 8px 12px; }
.pt-jobthumb {
  width: 60px; height: 60px; border-radius: 9px;
  background-color: var(--surface-2);
  /* Match the side card: contain shows the whole model, never cropped/truncated
     (a zoom > 100% cut off tall models like the bowls). */
  background-size: contain; background-position: center; background-repeat: no-repeat;
  border: 1px solid var(--border);
}
/* Job column */
.pt-td--job { min-width: 140px; }
.pt-td--eta, .pt-th--eta { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pt-td--eta { font-weight: 600; }
.pt-job-bar { height: 4px; background: var(--border); border-radius: 2px;
              overflow: hidden; margin-bottom: 4px; }
.pt-job-bar span { display: block; height: 100%; background: var(--info);
                   border-radius: 2px; transition: width .4s; }
.pt-job-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pt-job-pct   { font-size: 11px; color: var(--muted); }
.pt-job-file  { font-size: 10px; color: var(--muted); margin-top: 2px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.pt-job-idle  { color: var(--muted); font-size: 12px; }

/* ── Printer cam wall ────────────────────────────────────────────────────── */
/* (The "Detach" button moved to the toolbar actions slot — see #camWallDetachTop.) */

.cam-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 16px; padding: 0 0 16px; align-items: start; }
/* Normal cards span 2 sub-columns → 320px minimum, same visual as before */
.cam-wall-card { position: relative; background: var(--surface); border: 1px solid var(--border);
                 border-radius: var(--radius); overflow: hidden;
                 cursor: grab; transition: border-color .15s;
                 grid-column: span 2; }
.cam-wall-card:hover { border-color: var(--info); }
/* Drag-to-reorder ("make room") — dragged card hidden, others slide (see printer grid). */
.cam-wall-card--dragging { opacity: 0; }
/* Prevent native image/video drag from intercepting card DnD */
.cam-wall-card img,
.cam-wall-card video { -webkit-user-drag: none; }

/* ── Cam wall overlay header ─────────────────────────────────────────────── */
/* Header floats above the camera feed (absolute positioned). The card height is
   determined purely by the 16:9 camera content — no wasted space from the header. */
.cam-wall-card-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.72) 0%, transparent 100%);
  opacity: 0; transition: opacity .18s;
}
.cam-wall-card:hover .cam-wall-card-head { opacity: 1; }
.cam-wall-card-name { font-weight: 500; font-size: 13px; color: var(--on-dark); min-width: 0;
                      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Cam wall size controls ──────────────────────────────────────────────── */
.cam-size-btns { display: flex; gap: 3px; margin-left: auto; flex-shrink: 0; }
.cam-size-btn {
  display: flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px;
  font-size: 10px; font-weight: 700; line-height: 1;
  border: 1px solid var(--ink-30); border-radius: 3px;
  background: var(--scrim); color: var(--ink-85);
  cursor: pointer; transition: background .1s, color .1s, border-color .1s;
}
.cam-size-btn:hover { background: var(--ink-20); color: var(--on-dark); border-color: var(--ink-60); }
.cam-size-btn--active { background: var(--info); border-color: transparent; color: var(--on-accent); }
.cam-size-btn svg { pointer-events: none; }

/* Camera containers fill full card width — card height = camera height (pure 16:9).
   min-height: 0 overrides the global pp-cam-full floor (200px) set in 50-snapmaker.css. */
.cam-wall-card .pp-cam-full { min-height: 0; }
.cam-wall-card .pp-cam-full,
.cam-wall-card .snap-camera-frame,
.cam-wall-card .cre-cam-video,
.cam-wall-card .cre-cam-mjpeg,
.cam-wall-card img[src*="8898"] { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }

/* ½× compact — spans 1 sub-column (half of a normal card) */
.cam-wall-card--sm { grid-column: span 1; }
.cam-wall-card--sm .cam-wall-card-head { padding: 5px 7px; gap: 4px; }
.cam-wall-card--sm .cam-wall-card-name { font-size: 10px; }
.cam-wall-card--sm .printer-brand-pill { display: none; }
.cam-wall-card--sm .cam-size-btn { min-width: 18px; height: 16px; font-size: 9px; padding: 0 3px; }
/* 2× wide — spans 4 sub-columns */
.cam-wall-card--2x { grid-column: span 4; }

/* Fullscreen — header back in normal flow, always visible.
   The card is put in the top layer by the Fullscreen API, which is what makes it
   cover the SCREEN rather than the app window. These rules stay because they are
   also the fallback when the platform refuses the request — then the card fills
   the window, as it always used to. The background is stated explicitly: a
   fullscreen element is painted against nothing, so a transparent card would
   show black around its own content. */
.cam-wall-card--fs {
  position: fixed; inset: 0; z-index: 200;
  border-radius: 0; border: none;
  display: flex; flex-direction: column;
  background: var(--surface);
}
.cam-wall-card--fs:fullscreen { width: 100%; height: 100%; }
.cam-wall-card--fs .cam-wall-card-head {
  position: relative; opacity: 1; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.cam-wall-card--fs .cam-wall-card-name { color: var(--text); }
.cam-wall-card--fs .cam-size-btn {
  border-color: var(--border); color: var(--muted); background: transparent;
}
.cam-wall-card--fs .cam-size-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
/* Camera container fills remaining height — override the 16:9 aspect-ratio box */
.cam-wall-card--fs .pp-cam-full { flex: 1; min-height: 0; aspect-ratio: unset; }

/* Connecting placeholder — shown while the brand module establishes the connection */
.cam-wall-card--connecting { opacity: .75; }
.cam-wall-connecting {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; aspect-ratio: 16/9;
  background: var(--surface-2);
  color: var(--muted); font-size: 13px;
}
.cam-wall-connecting .inv-loading-spin {
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  background: none; -webkit-mask: none; mask: none;   /* keep the small border spinner (not the big gradient loader) */
  animation: spin .7s linear infinite;
}

  /* (Earlier .pba-brand-row wrapper removed — tutorial pill now lives inside
     .pba-brand between the labels and the chevron. Pill styling is in
     60-modals.css — .pba-brand-tuto-link.) */

  /* ── Job keys on a board card — pause / stop while a print runs ──────────
     A COLUMN down the RIGHT edge of the photo, mirroring the brand badge on the
     left: the left side is the badge's, and a stack beneath it left the photo
     nothing to breathe in. They keep the badge's plate so the two edges read as
     a pair. The head's row above is the card's own controls (move, ⋮) — what
     this app can do to the card — while these are what the machine can be told
     to do; keeping them apart is what lets each be read at a glance. Present
     only while a job runs, which is the only time they mean anything. */
  .printer-card-jobkeys {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    display: flex; flex-direction: column; gap: 4px;
  }
  .printer-card-jobkeys .rp-job-btn {
    position: relative; overflow: hidden;
    width: 34px; height: 34px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 9px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    cursor: pointer; transition: background .15s;
  }
  /* The panel's own colours — blue for pause/resume, red for stop — so the same
     two controls look the same wherever you meet them. One difference, and it is
     forced: the panel tints over transparency, while these sit on a PHOTO, so
     the tint is composited over the opaque plate instead. A translucent wash
     over a bright print bed would leave them unreadable. */
  .printer-card-jobkeys .rp-job-btn        { background: color-mix(in srgb, var(--info) 14%, var(--surface)); }
  .printer-card-jobkeys .rp-job-btn:hover  { background: color-mix(in srgb, var(--info) 26%, var(--surface)); }
  .printer-card-jobkeys .rp-job-btn .icon  { background: var(--primary); position: relative; z-index: 1; }
  .printer-card-jobkeys .rp-job-btn.is-confirming        { background: var(--primary); }
  .printer-card-jobkeys .rp-job-btn.is-confirming .icon  { background: var(--on-accent); }

  .printer-card-jobkeys .rp-job-btn--stop       { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
  .printer-card-jobkeys .rp-job-btn--stop:hover { background: color-mix(in srgb, var(--danger) 26%, var(--surface)); }
  .printer-card-jobkeys .rp-job-btn--stop .icon { background: var(--danger); }
  .printer-card-jobkeys .rp-job-btn--stop.is-confirming       { background: var(--danger); }
  .printer-card-jobkeys .rp-job-btn--stop.is-confirming .icon { background: var(--on-accent); }
  /* The hold fill MUST be visible against the key's own plate — a hold button
     whose progress cannot be seen reads as broken, because nothing happens
     until the hold completes and the user lets go first. */
  .printer-card-jobkeys .rp-job-btn--stop .hold-progress {
    position: absolute; left: 0; top: 0;
    width: 0; height: 100%;
    background: color-mix(in srgb, var(--danger) 34%, transparent);
    opacity: 1;
    pointer-events: none;
  }

  /* ── Print widget on the board ───────────────────────────────────────────
     The panel's job block, placeable: preview, file, percentage, bar, state,
     remaining time, finish clock, layers. It keeps the board's card width like
     every other widget, so a machine's column stays a column. */
  .job-card-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 0; }
  .job-card-top  { display: flex; align-items: center; gap: 10px; }
  .job-card-thumb {
    width: 54px; height: 54px; flex: none; border-radius: 8px;
    background: var(--surface-2) center/cover no-repeat;
    border: 1px solid var(--border);
  }
  /* Falling back to the machine's photo: shown whole, not cropped, and set back
     a little so it reads as "no print" rather than as this print's preview. */
  .job-card-thumb--printer {
    background-size: contain;
    background-color: var(--surface-2);
    opacity: .7;
  }
  .job-card-meta { flex: 1; min-width: 0; }
  .job-card-file {
    font-size: 11.5px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Percentage and state on ONE line: they answer the same question. */
  .job-card-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .job-card-pct { display: flex; align-items: baseline; font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--text); letter-spacing: -.02em; }
  .job-card-pct-u { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 2px; }
  .job-card-bar {
    height: 5px; border-radius: 999px; overflow: hidden;
    background: var(--surface-3); flex: none;
  }
  .job-card-bar > span { display: block; height: 100%; background: var(--info); border-radius: 999px; }
  .job-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .job-card-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
  .job-card-val  { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
  /* Dimmed whole when the machine is not talking — the same treatment the
     storage and temperature widgets get, so a quiet machine reads the same
     everywhere on the board. */
  .job-card.is-stale .job-card-body { opacity: .55; filter: saturate(.5); }

  /* ── The camera's play key, on a machine card ───────────────────────────── */
  /* The play key. Big enough to be the obvious thing in an empty frame, quiet
     enough not to look like an alert on a board full of them. */
  .cam-play {
    width: 46px; height: 46px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 50%;
    background: var(--surface); cursor: pointer;
    transition: background .15s, transform .1s;
  }
  .cam-play .icon { background: var(--text); opacity: .85; }
  .cam-play:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
  .cam-play:hover .icon { background: var(--primary); opacity: 1; }
  .cam-play:active { transform: scale(.94); }
  /* On a machine card the key is centred over the photo and smaller — it shares
     the frame with the brand badge and the job keys, so it must read as one
     control among three rather than as the card's subject. */
  .cam-play--card {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 34px; height: 34px; z-index: 2;
    opacity: 0; transition: opacity .15s, background .15s;
  }
  .printer-card:hover .cam-play--card,
  .cam-play--card:focus-visible { opacity: 1; }
  .cam-play--card:active { transform: translate(-50%, -50%) scale(.94); }
  /* The feed takes the photo's place: same box, filled rather than contained —
     a camera frame cropped to the card reads better than one letterboxed. */
  /* The feed goes straight into the photo box, with NO wrapper — exactly the
     shape the camera wall uses. A wrapper of my own sat between the box and the
     16:9 element and took a height neither of them had asked for, which is what
     left a black band under the picture. */

  /* ── Feeds in a board frame — SIZED AS THE CAMERA WALL SIZES ITS OWN ──────
     Copied from `.cam-wall-card`, not reinvented: that view already answers
     "a feed in a box that is not the side panel". It clears the 200px floor
     `.pp-cam-full` carries for the panel, and names each brand's own element,
     because they letterbox by choice — right in the panel, where losing an edge
     would hide part of the bed; wrong on a thumbnail read at a glance. */
  .printer-card-thumb .pp-cam-full { min-height: 0; }
  .printer-card-thumb .pp-cam-full,
  .printer-card-thumb .snap-camera-frame,
  .printer-card-thumb .cre-cam-video,
  .printer-card-thumb .cre-cam-mjpeg,
  .printer-card-thumb img[src*="8898"] { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
  /* A feed FILLS its box; the box alone decides the shape. Needed because the
     photo area sizes any image to its intrinsic size (`width/height: auto`,
     `object-fit: contain`) — right for a product shot, wrong for a camera, which
     sat small and centred inside a correctly-shaped 16:9 frame. The camera wall
     never needed this rule: its cards hold no product photo. */
  .printer-card-thumb .pp-cam-full > img,
  .printer-card-thumb .pp-cam-full > video {
    display: block;
    width: 100%; height: 100%;
    max-width: none; max-height: none;
    object-fit: cover;
  }

  /* ── The camera wall as a PLAN ───────────────────────────────────────────
     Same surface as the storage and printer boards: cards placed by hand, a
     scroller that pans over them, a zoom that scales the whole thing from its
     top-left. The grid, the flow order and the ½×/1×/2× presets are gone — a
     grip answers the size question exactly instead of in three steps. */
  .cam-scroll { position: relative; overflow: auto; height: 100%; }
  .cam-wall--plan {
    position: relative;
    display: block;                 /* not a grid any more — cards are placed */
    transform-origin: 0 0;
    min-height: 240px;
  }
  .cam-wall--plan .cam-wall-card {
    position: absolute;
    grid-column: auto;              /* neutralise the old span rules */
    margin: 0;
    /* The card is only as tall as its head plus a 16:9 picture, so ONE number —
       the width — describes it. */
    height: auto;
  }
  /* No z-index here: the layout writes each card's depth inline, which this
     could never outrank. The lift is done in the drag itself, on the element. */
  .cam-wall--plan .cam-wall-card.is-plan-dragging { cursor: grabbing; }
  .cam-wall--plan .cam-wall-card.is-plan-selected,
  .cam-wall--plan .cam-wall-card.is-resizing {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  /* The move handle sits in the head, first, exactly like a rack's and a
     machine's — the card itself cannot be the handle here, because it is a video
     the user will click, drag across and put fullscreen. */
  /* The grip. Bottom-right, quiet until the card is hovered — a permanent
     handle on every camera would read as clutter on a wall of ten. */
  .cam-resize {
    position: absolute; right: 0; bottom: 0;
    width: 18px; height: 18px;
    cursor: nwse-resize;
    opacity: 0; transition: opacity .15s;
    z-index: 3;
  }
  .cam-resize::after {
    content: ""; position: absolute; right: 3px; bottom: 3px;
    width: 9px; height: 9px;
    border-right: 2px solid var(--on-dark); border-bottom: 2px solid var(--on-dark);
    border-bottom-right-radius: 3px; opacity: .75;
  }
  .cam-wall--plan .cam-wall-card:hover .cam-resize,
  .cam-wall--plan .cam-wall-card.is-resizing .cam-resize { opacity: 1; }
  /* Fullscreen leaves the plan entirely — pinned to the window, not placed on
     the surface beneath it. The layout stops writing inline geometry on this
     card while it is up, which is what lets these rules apply at all. */
  .cam-wall--plan .cam-wall-card--fs {
    position: fixed; inset: 0; width: auto; height: auto;
    outline: none; z-index: 2000;
  }

  /* ── Arranging the camera wall ───────────────────────────────────────────
     The same mesh the storage plan draws, at the same 24 px step, scaled by the
     zoom so it keeps matching the snap. Only while arranging: a wall you are
     watching should show pictures, not graph paper. */
  #invPrinterView.is-plan-edit .cam-scroll,
  #invPrinterView.is-plan-moving .cam-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 fine mesh is graph paper rather than a guide. */
  #invPrinterView.is-plan-coarse.is-plan-edit .cam-scroll,
  #invPrinterView.is-plan-coarse.is-plan-moving .cam-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));
  }
  /* While arranging the card is a thing you move, so it says so — and its head
     stops hiding, because that is where its name and its controls live and you
     are now working with the cards rather than watching them. */
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card { cursor: grab; outline: 1px solid var(--border); }
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card:hover { outline-color: var(--border-strong); }
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card-head { opacity: 1; }
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-resize { opacity: 1; }
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-plan-dragging { cursor: grabbing; }
  /* The head offers the grab, in both modes — it is the part of the card that is
     not the picture, so taking hold of it is never ambiguous. */
  .cam-wall--plan .cam-wall-card-head { cursor: grab; }
  .cam-wall--plan .cam-wall-card-head .cam-size-btns { cursor: default; }
  .cam-wall--plan .cam-wall-card.is-plan-dragging .cam-wall-card-head { cursor: grabbing; }

  /* A placed camera whose machine is quiet keeps its place and its size, drawn
     empty and set back. Dimmed rather than hidden: the arrangement is the point
     of this view, and a card that vanished when a printer slept would take a
     piece of it with it — while a solid black rectangle would read as a feed
     that had failed. Its head stays reachable, so it can still be moved and
     resized while the machine is off. */
  .cam-wall-card--offline { opacity: .5; }
  .cam-wall-card--offline:hover { opacity: .8; }
  .cam-wall-offline {
    width: 100%; aspect-ratio: 16 / 9;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2);
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
  }
  .cam-wall-offline .icon { background: var(--muted); opacity: .6; }

  /* ── The states of a camera card, in the order they must win ─────────────
     Arranging draws a plain border on every card, and that rule carries the
     view's id — so at lower specificity a SELECTION was silently overruled by
     it, and hovering a selected card overruled it again. Written here at the
     same weight and after it, so the outcome is decided by this order rather
     than by which selector happens to carry an extra class. Same accent, same
     2px, same offset as the storage and printer boards: a selection has to look
     identical wherever it is made. */
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-plan-selected,
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-plan-selected:hover,
  #invPrinterView .cam-wall--plan .cam-wall-card.is-plan-selected,
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-resizing,
  #invPrinterView .cam-wall--plan .cam-wall-card.is-resizing {
    outline: 2px solid var(--primary); outline-offset: 2px;
  }
  /* Held beats selected: while a set is moving, what is in the hand is what you
     need to see. */
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-plan-dragging,
  #invPrinterView.is-plan-edit .cam-wall--plan .cam-wall-card.is-plan-dragging:hover,
  #invPrinterView .cam-wall--plan .cam-wall-card.is-plan-dragging {
    outline: 2px solid var(--primary); outline-offset: 2px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  }

  /* The alignment guides must sit above the card being dragged. On the storage
     plan its cards live at a low depth, so the shared 1001 clears them; here a
     held card is lifted to the front deliberately, and the guides have to clear
     THAT — a guide hidden behind the thing it is guiding explains nothing. */
  .cam-wall--plan .rp-plan-guides { z-index: 9500; }

/* ── Print progress fill — one colour rule for every job bar ────────────────
   (table, printer cards, board, dashboard widget, each brand's side card).
   Blue while printing; green at 100 % when done; red when the job failed and
   grey when it was cancelled — both frozen at the % the bar had while it was
   still blue (renderer/printers/job-bar.js). One flat colour, no gradient. */
.job-fill { transition: width .4s, background-color .3s; }
.job-fill.job-fill--run,
.job-fill.job-fill--idle { background: var(--info); }
.job-fill.job-fill--done { background: var(--success); }
.job-fill.job-fill--fail { background: var(--danger); }
.job-fill.job-fill--stop { background: var(--muted); }

/* "Beta" next to a brand in the add-printer picker (Prusa while it is new). */
.pba-beta-tag {
  display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; vertical-align: middle;
  background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary-text);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
/* The Beta mark at the top of a beta printer's live block (printers/beta-badge.js):
   the tag + an ⓘ whose hover bubble carries the explanation. */
.printer-beta-row { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; }
.printer-beta-row .pba-beta-tag { margin-left: 0; }
.pba-brand-label .printer-beta-info { margin-left: 4px; vertical-align: middle; }
/* The Demo mark of a demo printer (printers/demo-badge.js, docs/DEMO-MODE.md):
   same shape as the Beta tag, in the info colour so the two never read alike. */
.printer-demo-tag {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; vertical-align: middle;
  background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info-text);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.pba-brand-label .printer-demo-tag { margin-left: 6px; }
.printer-demo-info { margin-left: 4px; vertical-align: middle; }
.printer-demo-info:hover .icon, .printer-demo-info:focus-visible .icon { background: var(--info); }
.printer-card-demo, .pp-demo-mark { display: inline-flex; align-items: center; flex-shrink: 0; }
.pba-demo-head {
  margin: 14px 4px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.printer-beta-info { display: inline-flex; align-items: center; cursor: help; border: none; background: none; padding: 0; }
.printer-beta-info .icon { background: var(--faint); transition: background .15s; }
.printer-beta-info:hover .icon, .printer-beta-info:focus-visible .icon { background: var(--primary); }

/* ── Brand picker: "Find your printer" across every connector (printers/model-finder.js) ── */
.pba-find {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 14px 0; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.pba-find:focus-within { border-color: var(--primary); }
.pba-find .icon { background: var(--muted); flex-shrink: 0; }
.pba-find .pba-find-input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--text); font-size: 13px; padding: 0;
}
.pba-find .pba-find-input:focus,
.pba-find .pba-find-input:hover { border: none; background: transparent; box-shadow: none; outline: none; }
.pba-find-results[hidden], .pba-brands[hidden] { display: none; }
.pba-find-item { display: flex; flex-direction: column; gap: 4px; }
.pba-find-thumb {
  width: 60px; height: 60px; flex-shrink: 0; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.pba-find-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pba-find-conns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.pba-find-conn {
  font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent);
}
.pba-find-conns { align-items: center; }
/* A connector and its Beta tag stay together on one line. */
.pba-find-connset { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pba-find-connset .pba-beta-tag { margin-left: 0; padding: 0 5px; font-size: 9px; line-height: 15px; }
/* A result card sizes to its content (name may wrap + connector chips), with air
   top and bottom; the hidden choice below it must not take room (display:flex
   would override [hidden]). */
.pba-find-results .pba-find-row { height: auto; min-height: 56px; padding: 8px 14px 8px 8px; }
.pba-find-choice[hidden] { display: none; }
.pba-find-choice { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 6px 18px; }
.pba-find-how { margin: 2px 0 2px; font-size: 12px; color: var(--muted); }
.pba-find-pick {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pba-find-pick:hover { border-color: var(--primary); }
.pba-find-pick .pba-brand-logo { width: 22px; height: 22px; }
.pba-find-empty { margin: 8px 2px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
/* The picker's lists scroll without a visible bar (same as the model picker). */
#printerBrandPickerPanel .pba-brands { scrollbar-width: none; }
#printerBrandPickerPanel .pba-brands::-webkit-scrollbar { display: none; }

/* ── Demo printer picker (debug mode): every model of every brand the simulator plays ── */
.pba-demo-logo { width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.pba-demo-logo .icon { background-color: var(--info); }
.pba-demo-group {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 4px 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.pba-demo-group:first-child { margin-top: 2px; }
.pba-demo-group[hidden] { display: none; }
.pba-demo-group .pba-brand-logo { width: 20px; height: 20px; }
.pba-demo-group-text { display: flex; flex-direction: column; line-height: 1.2; }
.pba-demo-group-text b { font-size: 13px; }
.pba-demo-group-text span { font-size: 11px; color: var(--muted); }
.pba-mp-opt .pba-demo-add { margin-left: auto; background-color: var(--muted); transition: background-color .15s; }
.pba-mp-opt:hover .pba-demo-add { background-color: var(--primary); }
.pba-mp-opt.loading { opacity: .5; pointer-events: none; }

/* ── Camera photo / video (printers/cam-snapshot.js) — on every .pp-cam-full ── */
.pp-cam-full { position: relative; }
.cam-cap-bar {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; pointer-events: none;
}
.pp-cam-full:hover > .cam-cap-bar, .pp-cam-full.cam-recording > .cam-cap-bar { opacity: 1; transform: none; pointer-events: auto; }
/* Hidden at once for a window capture (cross-origin stream, e.g. Elegoo CC2):
   no fade, or the capture, taken two frames later, still shows the buttons. */
.pp-cam-full.pp-cam-full.cam-snap-hide > .cam-cap-bar { opacity: 0; visibility: hidden; transition: none; }
/* The camera wall is drawn at full size then scaled (--plan-z): undo it so the
   buttons keep their real on-screen size at any zoom. */
.cam-wall--plan .cam-cap-bar { zoom: calc(1 / var(--plan-z, 1)); }
.cam-cap-btn.cam-cap-btn {
  width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(10,12,16,.62); backdrop-filter: blur(6px); transition: background .15s, transform .15s;
}
.cam-cap-btn:hover { background: rgba(10,12,16,.82); transform: scale(1.06); }
.cam-cap-btn .icon { background-color: #fff; width: 22px; height: 22px; }
.cam-rec-dot { width: 18px; height: 18px; border-radius: 50%; background: #ff3b30; transition: border-radius .15s, transform .15s; }
.cam-rec-btn.is-on .cam-rec-dot { border-radius: 3px; transform: scale(.85); animation: cam-rec-pulse 1.2s ease-in-out infinite; }
.cam-rec-time {
  padding: 6px 12px; border-radius: 999px; background: #ff3b30; color: #fff;
  font: 700 14px/1 ui-monospace, "SF Mono", Menlo, monospace;
}
.cam-rec-time[hidden] { display: none; }
@keyframes cam-rec-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .cam-rec-btn.is-on .cam-rec-dot { animation: none; } }

/* ── Add flow: the model being added, recalled on the scan / manual steps ── */
.pba-picked {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  padding: 8px 12px 8px 8px; border-radius: 12px;
  background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--border);
}
.pba-picked .pba-mp-thumb { width: 48px; height: 48px; flex-shrink: 0; }
.pba-picked-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pba-picked-name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pba-picked-sub { font-size: 12px; color: var(--muted); }
.snap-scan-body > div:first-child:empty, .pba-body > div:first-child:empty, .pba-picked-slot:empty { display: none; }
.pba-picked-slot { padding: 4px 14px 0; }
.pba-picked-slot .pba-picked { margin-bottom: 4px; }

/* ── A rarely-needed field behind a switch (schema `toggleKey`) ── */
.pba-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; padding: 4px 0; }
.pba-toggle-body { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .2s ease, opacity .2s ease; }
.pba-toggled.is-on .pba-toggle-body { grid-template-rows: 1fr; opacity: 1; }
.pba-toggle-inner { overflow: hidden; min-height: 0; }
.pba-toggle-inner > .pba-field { padding-top: 8px; }
@media (prefers-reduced-motion: reduce) { .pba-toggle-body { transition: none; } }

/* Printer settings → Camera: the Settings toggle row bleeds 8 px each side for
   its hover fill; padding brings its text back onto the form's label edge. */
.pba-toggle-row { padding: 4px 8px; }

/* ── External IP cameras (renderer/ext-cam) ─────────────────────────────────
   Cards of the camera wall like a printer's (the wall draws the card, this is
   the picture inside it) and cards on the printers board. */
.xc-gear { display: inline-flex; padding: 4px; border: none; border-radius: 6px; background: color-mix(in srgb, var(--on-dark) 18%, transparent); cursor: pointer; }
.xc-gear:hover { background: color-mix(in srgb, var(--on-dark) 32%, transparent); }
.xc-gear .icon { background-color: var(--on-dark); }
.xc-view { position: relative; aspect-ratio: 16 / 9; background: var(--media-bg); }
.xc-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.xc-overlay {
  position: absolute; inset: 0; z-index: 2; display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--on-dark);
}
.xc-overlay .icon { background-color: var(--muted); opacity: .6; }
.cam-wall-card[data-state="connecting"] .xc-overlay--connecting,
.cam-wall-card[data-state="error"] .xc-overlay--error,
.xc-board-card[data-state="connecting"] .xc-overlay--connecting,
.xc-board-card[data-state="error"] .xc-overlay--error,
.xc-embed[data-state="connecting"] .xc-overlay--connecting,
.xc-embed[data-state="error"] .xc-overlay--error { display: flex; }
/* An external camera shown in place of a printer's own: it fills the printer's
   16:9 camera box (`.pp-cam-full`) instead of sizing itself. */
.xc-embed > .xc-view { position: absolute; inset: 0; aspect-ratio: auto; }
/* A feed fills a card's 16:9 box like the printer's own. */
/* The printer settings' "Camera shown" dropdown: the app's styled select (on the right of its title),
   with the step buttons' corners, height and orange outline. Wide enough for its label — the filter
   look caps it at 180px, which cut the text. The outline is the same whether a camera is chosen or
   not (the filled orange look of a chosen filter, .is-active, is not used here). */
.pba-camsource-row .csel { width: auto; max-width: 62%; margin-left: auto; }
.pba-camsource-row .csel-btn { height: 35px; max-width: none; border-radius: 8px; }
.pba-camsource-row .csel-btn,
.pba-camsource-row .csel-btn.is-active { background-color: transparent; border-color: var(--primary); color: var(--text); font-weight: 400; }
.pba-camsource-row .csel-btn:hover,
.pba-camsource-row .csel--open .csel-btn { background-color: var(--primary-soft); border-color: var(--primary); }
.pba-camsource-row .csel-pop { min-width: 100%; width: max-content; max-width: 280px; right: 0; left: auto; }
.pba-camsource-row .csel-opt.is-sel { color: var(--text); font-weight: 600; background: var(--ink-10); }
.printer-card-thumb .xc-embed .xc-media { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
/* An <img> with no address yet is drawn by Chromium as a broken image: a light
   frame round the black picture. Nothing to show until the first picture. */
.xc-media:not([src]) { visibility: hidden; }

/* Add / edit card */
.xc-seg { display: flex; gap: 6px; }
.xc-seg button {
  flex: 1; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 12px; cursor: pointer; transition: border-color .12s, background .12s;
}
.xc-seg button:hover { border-color: var(--info); }
.xc-seg button[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.xc-test { font-size: 12px; color: var(--muted); }
.xc-test[data-state="ok"]   { color: var(--success-text); }
.xc-test[data-state="fail"] { color: var(--danger-text); }
/* `hidden` alone loses to .adf-btn's display, so say it again for the two buttons the card swaps. */
.pba-footer .xc-delete[hidden], .pba-footer #xcBack[hidden] { display: none; }
.pba-footer .xc-delete { flex: 0 0 auto; }
#xcOverlay .pba-footer { flex-wrap: nowrap; }
#xcOverlay .pba-footer .adf-btn { white-space: nowrap; flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
#xcOverlay .pba-footer #xcSave { flex: 1 1 auto; justify-content: center; }

/* ── External cameras on the printers board ──────────────────────────────────
   A board object like a machine's card: placed by the board's own layout, moved
   by its handle (or anywhere in Arrange), selected by the sweep. Same width as a
   machine, the picture 16:9 under a one-line head. */
.printers-grid--plan .xc-board-card {
  position: absolute; margin: 0; width: var(--board-card-w);
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s;
}
.printers-grid--plan .xc-board-card:hover { border-color: var(--info); }
#invPrinterView.is-plan-edit .printers-grid--plan .xc-board-card { cursor: grab; }
/* The head is a machine's head (name + status dot, same classes). The dot says
   where the camera stands: grey when it is offline (no signal), blue while it
   connects, green once the picture is live. */
.xc-board-card[data-state="connecting"] .printer-card-name-dot {
  background: var(--info);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 18%, transparent);
  animation: xc-dot-pulse 1.8s ease-in-out 3;
}
.xc-board-card[data-state="live"] .printer-card-name-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent);
  animation: printer-name-dot-pulse 1.8s ease-in-out 3;
}
@keyframes xc-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--info) 50%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--info) 0%, transparent); }
}
.xc-board-card .xc-view { border-radius: 6px; overflow: hidden; }
.printers-grid--plan .xc-board-card .rp-rack-btn { opacity: 0; transition: opacity .15s, background .15s; }
.printers-grid--plan .xc-board-card:hover .rp-rack-btn,
.printers-grid--plan .xc-board-card .rp-rack-btn:focus-visible { opacity: 1; }
.printers-grid--plan .xc-board-card .rp-rack-move { cursor: grab; }
.printers-grid--plan .xc-board-card.is-plan-dragging {
  cursor: grabbing; box-shadow: 0 14px 34px rgba(0,0,0,.45);
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.printers-grid--plan .xc-board-card.is-plan-selected { outline: 2px solid var(--primary); outline-offset: 2px; }
.printers-grid--plan .xc-board-card.is-plan-overlapping { outline: 2px solid var(--danger); outline-offset: 2px; }
