/* renderer/labels — the label card (#labelPanel), a side card that opens on the
   RIGHT of the spool card and pushes it left (inventory.js _syncPanels).
   The label itself is a self-contained page (labels/index.js buildLabel), shown
   here in a scaled iframe: what is previewed is what is printed. */

#labelPanel { width: 400px; max-width: 95vw; display: flex; flex-direction: column; }
.lbl-body { flex: 1; overflow-y: auto; padding: 6px 18px 22px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; }
.lbl-body > * { flex-shrink: 0; }
.lbl-body .panel-label { margin: 4px 0 -4px; }
/* The same tools inside the product sheet's "QR label" tab: the tab scrolls, not them. */
.lbl-body.lbl-body--inline { flex: none; overflow: visible; padding: 4px 0 0; }

.lbl-seg { display: flex; gap: 6px; align-items: center; }
.lbl-seg .lbl-seg-btn { flex: 1; }
/* Spool Label / Filament Label: a two-state switch whose pill SLIDES between the
   two options (the account window's .eac-seg): one ::before placed by :has(). */
.lbl-seg.lbl-seg--kind { position: relative; gap: 0; padding: 2px; border-radius: 11px; isolation: isolate; background: var(--surface-2); border: 1px solid var(--border); }
.lbl-seg--kind::before { content: ""; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 9px; background: var(--primary); transition: transform .22s cubic-bezier(.4, 0, .2, 1); }
.lbl-seg--kind:has(.lbl-seg-btn:last-child.is-active)::before { transform: translateX(100%); }
.lbl-seg--kind .lbl-seg-btn.lbl-seg-btn { border: 0; background: transparent; border-radius: 9px; transition: color .18s; }
.lbl-seg--kind .lbl-seg-btn.is-active { background: transparent; color: var(--on-accent); }
/* Copies: the plans' − n + control, in the print key's row and as tall as the key. */
.lbl-ble-row .lbl-copies.rv-plan-zoom { flex: 0 0 auto; height: 40px; box-sizing: border-box; }
.lbl-ble-row .lbl-copies button { width: 26px; min-width: 0; height: 26px; padding: 0; }
.lbl-copies .lbl-copies-n.val.val { width: 22px; text-align: center; }
.lbl-copies .lbl-copies-n { min-width: 18px; text-align: center; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.lbl-copies button:disabled { opacity: .35; cursor: default; }
/* The sheet, under Print / PDF (the outputs it changes): a slim line, the same sliding pill. */
.lbl-sheet-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.lbl-sheet-lbl { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.lbl-seg--sheet { flex: 1; min-width: 0; }
.lbl-seg--sheet .lbl-seg-btn.lbl-seg-btn { padding: 5px 4px; font-size: 11.5px; white-space: nowrap; }
.lbl-seg--kind.lbl-seg--sheet::before { width: calc(33.333% - 1.4px); }
.lbl-seg--kind.lbl-seg--sheet:has(.lbl-seg-btn:nth-child(2).is-active)::before { transform: translateX(100%); }
.lbl-seg--kind.lbl-seg--sheet:has(.lbl-seg-btn:nth-child(3).is-active)::before { transform: translateX(200%); }
.lbl-hint.lbl-hint--sheet { text-align: center; margin: 6px 0 0; }
.lbl-seg-btn.lbl-seg-btn { height: auto; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.lbl-seg-btn:hover { border-color: var(--primary); }
.lbl-seg-btn.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.lbl-hint { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* The paper: white, whatever the theme — it is the label as printed. */
/* A fixed box (the tallest preview fits it): switching templates moves nothing below. */
.lbl-preview { display: flex; justify-content: center; align-items: center; height: 232px; padding: 4px 0 8px; }
.lbl-paper { position: relative; overflow: hidden; border-radius: 4px; background: var(--on-dark); box-shadow: 0 2px 10px rgba(0, 0, 0, .28); }
.lbl-frame { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; transition: opacity .15s; }
/* While the preview loads: the paper is blank and a spinner turns on it (spin: 70-detail-misc.css). */
.lbl-paper.is-loading .lbl-frame { opacity: 0; }
.lbl-paper.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin .8s linear infinite; }

.lbl-tpls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }   /* nine templates, three rows of three */
.lbl-tpl.lbl-tpl { height: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 9px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.lbl-tpl:hover { border-color: var(--primary); }
.lbl-tpl.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.lbl-tpl b { font-size: 12px; line-height: 1.2; text-align: center; }
.lbl-tpl small { font-size: 10.5px; color: var(--muted); }

/* The values lines, chosen on the preview itself: a key over each line where it
   prints (from the format's layout), shown on hover / focus; the empty one says +. */
.lbl-stage { position: relative; }
.lbl-hots { position: absolute; inset: 0; pointer-events: none; }
.lbl-hot { position: absolute; pointer-events: auto; display: flex; align-items: center; justify-content: center; padding: 0; height: auto; min-height: 0; border: 1.5px dashed transparent; border-radius: 4px; background: transparent; cursor: pointer; transition: background .15s, border-color .15s; }
.lbl-stage:hover .lbl-hot { border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.lbl-hot:hover, .lbl-hot:focus-visible, .lbl-hot[aria-expanded="true"] { border-style: solid; border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); outline: none; }
.lbl-hot .icon { background-color: var(--primary); opacity: 0; transition: opacity .15s; }
.lbl-stage:hover .lbl-hot.is-empty .icon, .lbl-hot.is-empty:focus-visible .icon { opacity: 1; }
.lbl-hint.lbl-hint--slots { text-align: center; margin: -2px 0 8px; }
/* Its menu: the app's own (.rp-menu), each value with what it prints for this spool. */
.lbl-menu .icon.is-off { visibility: hidden; }
.lbl-menu-val { margin-left: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
/* The QR's link, copied: under the preview, which opens it on a click. */
.lbl-linkrow { display: flex; justify-content: center; gap: 8px; margin: -4px 0 8px; }
.lbl-linkrow .icon { background-color: currentColor; }
.lbl-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lbl-actions .primary { flex: 1 1 100%; justify-content: center; }
.lbl-actions .ghost { flex: 1; justify-content: center; }
.lbl-actions .icon { background-color: currentColor; }
.lbl-msg { margin: 0; min-height: 0; font-size: 12.5px; color: var(--danger-text); }
.lbl-msg:empty { display: none; }
/* Bluetooth first: the default printer's key, and the switch to another one beside it. */
.lbl-ble-row { flex: 1 1 100%; display: flex; gap: 8px; }
.lbl-ble-row .lbl-ble { flex: 1; min-height: 40px; font-size: 13.5px; }
.lbl-ble-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; text-align: left; }
.lbl-ble-txt b { font-weight: 700; white-space: nowrap; }
.lbl-ble-txt small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 500; opacity: .85; }
/* The copies: the same look as the printer key beside them (40 px, rounded 12). */
.lbl-ble-row .lbl-copies.rv-plan-zoom { border-radius: 12px; background: var(--surface-2); padding: 0 5px; }
.lbl-ble-row .lbl-ble-switch.lbl-ble-switch { flex: 0 0 40px; min-height: 40px; padding: 0; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; transition: border-color .15s, background .15s; }
.lbl-ble-row .lbl-ble-switch.lbl-ble-switch:hover { border-color: var(--primary); }
.lbl-ble-row .lbl-ble .icon, .lbl-ble-row .lbl-ble-switch .icon { width: 16px; height: 16px; }
.lbl-ble-row .lbl-ble-switch.lbl-ble-switch { display: inline-flex; align-items: center; justify-content: center; }
.lbl-ble-row .lbl-ble-switch .icon { background-color: var(--primary); }
/* A batch: how many labels, and the preview browsed one by one. */
.lbl-batch { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.lbl-batch > b { font-size: 14px; }
.lbl-batch-nav { display: inline-flex; align-items: center; gap: 4px; }
.lbl-batch-nav .ghost { width: 30px; padding: 0; justify-content: center; }
.lbl-batch-nav .ghost .icon { background-color: currentColor; }
.lbl-batch-pos { min-width: 52px; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lbl-batch-resume { align-self: flex-start; }
.lbl-batch-resume .icon { background-color: currentColor; }
/* The wiki's page of the printers that work: a quiet link under the Bluetooth key and in the chooser. */
.lbl-ble-guide { flex: 1 1 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: -2px 0 2px; padding: 2px 0;
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.lbl-ble-guide:hover { color: var(--primary); text-decoration: underline; }
.lbl-ble-dev:hover .icon, .lbl-ble-dev.is-default .icon { background-color: var(--primary); }
/* The printers in range (openDialog, look "notice"): one row per printer, the default marked. */
.lbl-ble-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 2px; text-align: left; }
.lbl-ble-wait { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0; font-size: 12.5px; color: var(--muted); }
.lbl-ble-wait .ttc-spinner { position: static; width: 16px; height: 16px; margin: 0; }
/* The Brother QL printers on the network, under the Bluetooth ones (ql-printer.js). */
.lbl-net { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); text-align: left; }
.lbl-net-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lbl-net-head .icon { background-color: var(--muted); }
.lbl-net-add { display: flex; gap: 8px; margin-top: 8px; }
.lbl-net-add .lbl-net-ip { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.lbl-net-add .lbl-net-ip:focus { outline: none; border-color: var(--primary); }
.lbl-net-msg { min-height: 1em; margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.lbl-ble-dev { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.lbl-ble-dev:hover { background: var(--surface-hover); border-color: var(--primary); }
.lbl-ble-dev .icon { background-color: var(--muted); flex: 0 0 auto; }
.lbl-ble-dev-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lbl-ble-dev-txt b { font-size: 13.5px; }
.lbl-ble-dev-txt small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl-ble-dev-pill { flex: 0 0 auto; padding: 2px 8px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; }
.lbl-msg.is-info { color: var(--muted); }
/* The printer window: the Bluetooth logo alone on top, no tile around it. */
.lbl-ble-dlg .dlg-ico.dlg-ico { width: auto; aspect-ratio: auto; background: none; box-shadow: none; }
.lbl-ble-dlg .dlg-ico .icon { width: 44px; height: 44px; }
