/**
 * renderer/IoT/tigerscale/tigerscale.css
 *
 * All TigerScale-specific styles: header health icon, slide-in panel,
 * scale cards, chip badges, spool block, WebSocket live block.
 *
 * Loaded via a <link> tag in inventory.html AFTER the shared base
 * sheets so these rules inherit all CSS custom properties.
 */

/* ── Scale health (header, right of the TigerPod glyph) — ONE glyph per scale,
      capped at 2 (1 scale → 1, 2+ → 2). Each glyph is coloured by ITS scale:
      green active · blue standby · red offline · muted grey when none paired.
      A hover popover lists every scale with a matching status dot. */
.scale-health { cursor: pointer; position: relative; }   /* anchor for the popover */
.scale-glyphs { display: inline-flex; align-items: center; gap: 2px; }
.scale-glyph  { position: relative; display: inline-flex; align-items: center; }  /* anchor for its ping + battery */
.scale-health-icon {
  display: inline-block;
  height: 44px; aspect-ratio: 1 / 1;
  background-color: var(--neutral);
  -webkit-mask-image: url('../../../assets/svg/icons/icon_tigerscale_3d.svg');
  /* 34px of ink in a 44px box — matches the TigerPod neighbour (~33px) without
     changing the header row's spacing. */
  -webkit-mask-size: auto 34px; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center;
  opacity: .38; transition: opacity .3s, background-color .3s, filter .3s;
}
.scale-glyph.scale-active .scale-health-icon {
  background-color: var(--success); opacity: 1;
  filter: drop-shadow(0 0 5px var(--success));
}
.scale-glyph.scale-standby .scale-health-icon {
  background-color: var(--info); opacity: 1;
  filter: drop-shadow(0 0 5px var(--info));
}
.scale-glyph.scale-offline .scale-health-icon {
  background-color: var(--danger); opacity: 1;
}
/* Live ping — rendered only inside an active glyph (JS adds it only then). */
.scale-live {
  position: absolute; top: 2px; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success); pointer-events: none;
  box-shadow: 0 0 0 2px var(--surface);
}
.scale-live::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--success); opacity: 0;
  /* Pings three times when the device comes online, then stays lit: a ping
     looping forever kept the whole window re-compositing at 60 fps — ~25 % CPU
     on an idle inventory (issue #66). */
  animation: scale-live-ping 1.4s ease-out 3;
}

/* Hover popover — one row per scale: coloured status dot + "Scale #N" + status. */
.scale-health-pop {
  position: absolute; top: calc(100% + 7px); right: 0; left: auto;
  transform: translateY(-4px);
  background: var(--dark-surface); border: 1px solid var(--dark-border); border-radius: 7px;
  padding: 5px 10px; display: flex; flex-direction: column; gap: 5px;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 60;
}
.scale-health:hover .scale-health-pop { opacity: 1; transform: translateY(0); }
.shp-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--on-dark); }
.shp-row--empty { color: var(--on-dark); opacity: .7; }
.shp-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--neutral); }
.shp-dot--active  { background: var(--success); }
.shp-dot--standby { background: var(--info); }
.shp-dot--offline { background: var(--danger); }
.shp-name   { flex: 1; }
.shp-status { opacity: .65; text-transform: lowercase; }

/* Battery over the bottom-left of the scale glyph — styled like an iOS phone
   battery: dark body (as on a status bar), coloured outline + nub, a proportional
   fill in the state colour, and a WHITE bold value inside. Reads "XX%" while
   discharging, "XX" + a bolt while charging. iOS colours: charging green / low
   <20 % red / neutral grey. currentColor carries the state colour. */
.scale-health-batt {
  position: absolute; left: -2px; bottom: -1px;
  display: inline-flex; align-items: center; justify-content: center; gap: 1px;
  min-width: 19px; height: 13px; padding: 0 2px; box-sizing: border-box;
  border: 1.2px solid currentColor; border-radius: 3px;
  background: #0e1116;          /* dark battery body — like a phone status bar */
  color: var(--muted);         /* default neutral outline/fill */
  box-shadow: 0 1px 3px rgba(0,0,0,.45); pointer-events: none;
}
.scale-health-batt::after {    /* terminal nub */
  content: ""; position: absolute; right: -3px; top: 50%; transform: translateY(-50%);
  width: 1.6px; height: 5px; border-radius: 0 2px 2px 0; background: currentColor;
}
.scale-health-batt .shb-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px 0 0 2px;
  background: currentColor;    /* solid, proportional charge level */
}
.scale-health-batt .shb-txt {
  position: relative; z-index: 1;
  color: #fff; font-weight: 800; font-size: 8px; letter-spacing: -.03em;
  text-shadow: 0 0 1.5px rgba(0,0,0,.55);
}
.scale-health-batt .shb-bolt {
  position: relative; z-index: 1; width: 5px; height: 8px; flex-shrink: 0;
  background-color: #fff;
  -webkit-mask-image: url('../../../assets/svg/icons/icon_bolt.svg');
  -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; -webkit-mask-position: center;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.5));
}
.scale-health-batt.is-charging { color: var(--success-text); }
.scale-health-batt.is-low      { color: var(--danger-text); }
.scale-health-batt.is-neutral  { color: var(--muted); }
@keyframes scale-live-ping {
  0%   { transform: scale(1);   opacity: .55; }
  100% { transform: scale(2.6); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .scale-live::before { animation: none; }
}

/* ── Scales panel (slide-in from right) ── */
#scalesPanel { width: min(420px, 92vw); }
#scalesPanelBody {
  padding: 16px 18px 24px;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
.scales-empty {
  text-align: center; padding: 36px 18px;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted); font-size: 13px;
}
/* Onboarding card — shown when the user has no scale yet. It is the only place
   the product is pitched, so it is built like a small product page: a lit stage
   for the photo, then what the machine does for you, then where to get one. */
.scales-empty-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
/* Lit stage — a soft radial pool under the scale so the photo reads as a
   product shot rather than an image dropped on a panel. */
.scales-empty-stage {
  position: relative; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 0 6px;
  border-radius: 12px;
  background: radial-gradient(ellipse 60% 55% at 50% 62%,
              color-mix(in srgb, var(--primary) 16%, transparent) 0%, transparent 70%);
}
.scales-empty-img {
  width: 100%; max-width: 216px;
  height: auto; object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.28));
}
/* Generation badge — the photo is the V3 body, and V2 owners need to see at a
   glance that this is a different machine, not a firmware update. */
.scales-empty-badge {
  position: absolute; top: 4px; right: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--primary); color: var(--on-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
}
.scales-empty-title {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.scales-empty-sub {
  font-size: 12.5px; color: var(--muted); line-height: 1.5;
  max-width: 320px;
}
/* Feature rows — real masked icons instead of ✓ glyphs: each row says which
   part of the machine does the work, so the list scans without being read. */
.scales-empty-feats {
  list-style: none; padding: 0; margin: 4px 0 0;
  text-align: left; align-self: stretch;
  display: flex; flex-direction: column; gap: 8px;
}
.scales-empty-feats li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: var(--text); line-height: 1.45;
}
.scales-empty-feats .ic {
  flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary-text);
}
/* Height only — each icon keeps the ratio of its own viewBox. */
.scales-empty-feats .ic .icon { height: 14px; width: 14px; }
.scales-empty-feats .ic .icon-nfc { width: 21px; }  /* viewBox 48 / 32 */
/* Two destinations: the firmware (GitHub) and the printable body (MakerWorld).
   Each keeps the brand colour it already has in the sidebar, so the same
   destination looks the same everywhere in the app. Stacked full-width rather
   than side by side — the panel is 420px and the two labels never fit on one
   line in every locale; a deliberate stack beats a per-language ragged wrap. */
.scales-empty-ctas {
  margin-top: 6px;
  align-self: stretch;
  display: flex; flex-direction: column; gap: 8px;
}
.scales-empty-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--on-dark); text-decoration: none;
  transition: background .15s, box-shadow .2s, transform .12s;
}
.scales-empty-cta:hover { transform: translateY(-1px); }
.scales-empty-cta .icon { background: currentColor; }
.scales-empty-cta--github { background: #2d333b; }
.scales-empty-cta--github:hover { background: #3a414b; box-shadow: 0 3px 14px rgba(0,0,0,.4); }
.scales-empty-cta--makerworld { background: #00BCA0; }
.scales-empty-cta--makerworld:hover { background: #00a890; box-shadow: 0 3px 14px rgba(0,188,160,.4); }
.scales-empty-license {
  font-size: 10.5px; color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

/* ── Scale entry — grouping wrapper (no visual style) ── */
.scale-entry {
  display: flex; flex-direction: column; gap: 8px;
}

/* ── Scale card — dark info card (head + chips + spool only) ── */
.scale-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ── Weight live card — TigerScale V3 firmware look ──────────────────────
   Rebuilt by _buildScaleLocalBlockHtml on every WS frame. Palette + layout
   copied from the firmware's lvglBuildMainScreen() (LVCOL_* constants):
   weight + brand/material stacked left, container/filament/rack column
   right, separated by a vertical divider — same grammar as the scale's own
   screen. Colours are fixed (not app-theme vars) so this card always reads
   like the physical device regardless of Studio's light/dark setting. */
.sc2-live-card {
  --fw-card:   #141821;
  --fw-border: #2E3646;
  --fw-muted:  #8A93A6;
  --fw-accent: #2F7FFF;
  --fw-green:  #3BA55D;
  --fw-red:    #E24B4A;
  --fw-yellow: #F2B705;
  --fw-orange: #E8821E;
  /* Outer shell matches the .scale-card above it (var(--surface-2)) so the
     two stack as one continuous panel; only the inner .main-card keeps the
     firmware's own darker tone, like a screen nested inside the app card. */
  background: var(--surface-2);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  color: #fff;
  padding: 12px;
}

/* ── Top strip — status pill + scale name ── */
.top-strip {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.send-status {
  font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  letter-spacing: .03em; white-space: nowrap; color: #fff;
}
/* Same reason as the Tare strip: the name sits on the card SHELL, not on the
   firmware's dark screen, so it follows the theme. Unchanged in dark, where
   --text is near-white; it was simply invisible in light. */
.top-strip .user-name {
  font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: .01em;
}

/* ── Main card — weight+brand (left) | container/filament/rack (right) ── */
.main-card {
  background: var(--fw-card);
  border: 1px solid var(--fw-border);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex; align-items: stretch;
}
.mc-left {
  position: relative;
  flex: 0 0 46%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px 0;
}
.mc-twin-badge { position: absolute; top: 0; left: 8px; }
/* Grey variant — single chip, no known twin. Same shape as .card-tl-badge--twin
   (70-detail-misc.css) so a spool that later gets twinned just changes colour,
   never shape. */
.card-tl-badge--single { background: var(--muted); }
.weight-display { display: flex; align-items: baseline; gap: 4px; }
.sc2-weight-num {
  font-size: 38px; font-weight: 800;
  line-height: 1; letter-spacing: -.03em; color: #fff;
}
.weight-unit {
  font-size: 16px; font-weight: 500;
  color: var(--fw-muted);
}
/* Brand/material — stacked under the weight, like lvBrandCard in the firmware */
.brand-block {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  margin-top: 10px; min-height: 28px;
}
.brand-row { display: flex; align-items: center; gap: 5px; }
.brand-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.brand-name { font-size: 12px; font-weight: 600; color: #fff; }
.material-name { font-size: 10px; color: var(--fw-muted); }

.mc-vdiv { width: 1px; background: var(--fw-border); align-self: stretch; margin: 2px 12px; }

.mc-right {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.mc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.mc-label { font-size: 11px; color: var(--fw-muted); white-space: nowrap; }
.mc-value { font-size: 12px; color: #fff; font-weight: 600; white-space: nowrap; }
.mc-hdiv { height: 1px; background: var(--fw-border); margin: 2px 0; }
.mc-loc-row { display: flex; align-items: center; gap: 6px; }
.mc-loc-icon {
  width: 12px; height: 12px; flex-shrink: 0;
  background-color: var(--fw-muted);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.mc-loc-icon--home { -webkit-mask-image: url('../../../assets/svg/icons/icon_home.svg'); mask-image: url('../../../assets/svg/icons/icon_home.svg'); aspect-ratio: 1/1; }
.mc-loc-icon--pin  { -webkit-mask-image: url('../../../assets/svg/icons/icon_pin.svg');  mask-image: url('../../../assets/svg/icons/icon_pin.svg');  aspect-ratio: 1/1; }
.mc-loc-value {
  font-size: 11px; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Head — photo (left) + identity column (centre) + actions (right) */
.scale-card-head {
  display: flex; align-items: center; gap: 12px;
}
.scale-card-photo {
  width: 56px; height: 56px; flex-shrink: 0;
  object-fit: contain; border-radius: 10px;
  background: var(--surface); padding: 4px;
  border: 1px solid var(--border);
  user-select: none; -webkit-user-drag: none;
}
.scale-card-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.scale-card-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.scale-card-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.scale-card-status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600;
  text-transform: lowercase; letter-spacing: .01em; flex-shrink: 0;
}
.scale-card-status-pill.is-online  { background: var(--success-soft); color: var(--success-text); }  /* active  */
.scale-card-status-pill.is-standby { background: var(--info-soft);    color: var(--info-text);    }  /* standby */
.scale-card-status-pill.is-offline { background: var(--danger-soft);  color: var(--danger-text);  }  /* offline */
.scale-card-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block; background: currentColor;
}
/* Glow the dot on an alive card — active (green) or standby (blue). */
.scale-card.is-online .scale-card-status-pill .scale-card-status-dot {
  box-shadow: 0 0 4px currentColor;
}
.scale-card-mac {
  font-size: 10.5px; color: var(--muted);
  font-family: var(--mono); letter-spacing: .02em;
}
.scale-card-actions { display: flex; gap: 4px; flex-shrink: 0; align-self: flex-start; }

/* Legacy scale-card-btn (kept for hold-to-confirm base) */
.scale-card-actions { display: flex; gap: 4px; flex-shrink: 0; align-self: flex-start; }
.scale-card-btn {
  /* Hold-to-confirm container: position:relative + overflow:hidden so
     the .hold-progress fill child can animate inside without leaking
     outside the rounded rect. */
  position: relative; overflow: hidden;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 8px;
  cursor: pointer; transition: background .15s;
}
.scale-card-btn:hover { background: var(--danger-soft); }
/* Icon sits above the .hold-progress fill, so the red fill grows
   UNDER the trash glyph instead of obscuring it. */
.scale-card-btn .icon {
  position: relative; z-index: 1;
  background: var(--muted);
  transition: background .15s;
}
.scale-card-btn:hover .icon { background: var(--danger); }
/* While holding, lock the icon to the danger colour and bump the
   button background to the soft-red so the fill animation pops
   against the surrounding card. */
.scale-card-btn.is-holding,
.scale-card-btn.is-confirming {
  background: var(--danger-soft);
}
.scale-card-btn.is-holding .icon,
.scale-card-btn.is-confirming .icon { background: var(--danger); }

/* WS connect/disconnect button — not destructive, use accent hover instead of danger */
.scale-card-btn--ws:hover             { background: rgba(99,102,241,.12); }
.scale-card-btn--ws:hover .icon       { background: var(--info); }
/* Connected state: green indicator */
.scale-card-btn--ws.is-ws-on          { background: color-mix(in srgb, var(--success) 12%, transparent); }
.scale-card-btn--ws.is-ws-on .icon    { background: var(--success); }
.scale-card-btn--ws.is-ws-on:hover    { background: color-mix(in srgb, var(--success) 20%, transparent); }
.scale-card-btn--ws.is-ws-on:hover .icon { background: var(--success); }

/* ── Chips strip — telemetry at a glance.
   A horizontal row of compact pills, each showing one piece of info
   (Wi-Fi signal, power source, battery, firmware, last seen). Wraps
   on narrow viewports so nothing is clipped. */
.scale-card-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.scale-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}
.scale-chip .icon {
  background: currentColor; /* SVG mask — colour follows chip text */
  flex-shrink: 0;
}
.scale-chip-text { font-weight: 500; }
/* Bolt overlay shown on the power chip when is_charging == true */
.scale-chip-bolt {
  color: var(--warning-text);
  margin-left: 1px;
}

/* Wi-Fi colour = connectivity, matching the scale's own screen (green whenever
   connected, red/off only when disconnected). Strength shows via the bar count,
   NOT the colour — so a working link is never painted as a red alarm. */
.scale-chip--wifi     { color: var(--text); }
.scale-chip--wifi-ok  { color: var(--success-text); }
.scale-chip--wifi-off { color: var(--muted); }

/* Battery colour — precedence charging → low → neutral (resolved in JS, one
   class only). Charging OUTRANKS low, so a cell being charged never shows the
   red alert. No chip background tint: the pill itself carries the colour. */
.scale-chip--bat-charging { color: var(--success-text); }
.scale-chip--bat-low      { color: var(--danger-text); }
.scale-chip--bat-neutral  { color: var(--text); }

/* Battery — iOS-style pill: coloured outline, proportional fill, value inside,
   plus a terminal nub. Colour follows the level class (or green while charging);
   the numeral stays var(--text) so it reads on the faint fill in either theme. */
.scale-chip--battery { gap: 4px; padding: 4px 7px; }
.scale-batt {
  position: relative; width: 26px; height: 13px; box-sizing: border-box;
  border: 1.5px solid currentColor; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.scale-batt::after {   /* terminal nub */
  content: ""; position: absolute; right: -4px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 5px; border-radius: 0 2px 2px 0; background: currentColor;
}
.scale-batt-fill { position: absolute; left: 0; top: 0; bottom: 0; background: currentColor; opacity: .28; }
.scale-batt-num {
  position: relative; z-index: 1;
  font-size: 9px; font-weight: 800; letter-spacing: -.03em; color: var(--text);
}
.scale-batt-bolt { color: var(--warning-text); }                   /* orange charge bolt */

/* Power chip — neutral by default */
.scale-chip--power { color: var(--muted); }

/* Firmware chip — subtle, monochrome */
.scale-chip--fw { color: var(--muted); }

/* Last-seen chip — subtle muted, only shown when offline */
.scale-chip--seen { color: var(--muted); }

/* ── Scale card — Debug-only raw JSON viewer ──────────────────────
   Collapsed by default, click "Raw JSON (debug)" to expand. Shows
   every field of the Firestore scales/{mac} doc so the developer
   can spot what the firmware is actually writing. */
.scale-debug {
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.scale-debug-summary {
  cursor: pointer;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  padding: 2px 4px;
  list-style: none;
  user-select: none;
}
.scale-debug-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform .15s ease;
}
.scale-debug[open] .scale-debug-summary::before {
  transform: rotate(90deg);
}
.scale-debug-summary:hover { color: var(--text); }
/* The dark JSON theme + syntax-highlight colours come from the
   canonical `pre.json` rule (see 70-detail-misc.css).
   We just add a small top margin so the block breathes. */
.scale-debug-pre {
  margin-top: 6px;
}

/* ── Scale local WebSocket live block ── */
/* Disconnected → the live block builds nothing → the WHOLE card goes, Tare
   included, rather than leaving an empty bordered box with a dead button in it. */
.sc2-live-card:has(> .scale-card-local:empty) { display: none; }

/* ── TARE hold-to-confirm button ──────────────────────────────────────
   Inside .sc2-live-card, directly under .main-card — the key beneath the
   screen, the way it sits on the scale itself. It therefore wears the
   firmware's own tones (--fw-card on --fw-border) rather than the app's, so it
   reads as part of the device instead of a control the app parked nearby.

   It is a SIBLING of .scale-card-local, never a child: that block is replaced
   wholesale on every WS delta (10 Hz), which would cancel a hold in progress.
   Hold 1 s to send POST /api/tare. */
.tare-hold-btn {
  position: relative; overflow: hidden;
  width: 100%;
  margin: 10px 0 0;
  padding: 9px 20px 10px;
  border: 1px solid var(--fw-border);
  border-radius: 12px;
  background: var(--fw-card);
  /* Always light: the key is always on the firmware's dark tone, in both themes. */
  color: #fff;
  cursor: pointer;
  transition: background .15s, transform .1s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  display: flex; align-items: center; justify-content: center;
}
.tare-hold-btn:hover:not(:disabled)  { background: color-mix(in srgb, #fff 8%, var(--fw-card)); }
.tare-hold-btn:active:not(:disabled) { transform: translateY(1px); }
.tare-hold-btn:disabled { opacity: .35; cursor: default; }

/* Visible face — au-dessus du fill. Two lines, like the key on the scale
   itself: the reading on top, the word beneath it. */
.tare-face {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.tare-value {
  font-size: 19px; font-weight: 800; line-height: 1.05;
  letter-spacing: -.02em; color: #fff;
}
.tare-text {
  font-size: 10.5px; font-weight: 700; line-height: 1;
  letter-spacing: .09em; color: rgba(255, 255, 255, .82);
}

/* Fill blanc qui grandit de gauche à droite sous le label.
   Explicitly light rather than var(--ink-40): the key keeps the firmware's dark
   tone in BOTH themes, and --ink-40 flips to a dark ink in light theme, which
   would leave the hold with no visible progress at all. */
.tare-progress {
  position: absolute;
  left: 0; top: 0;
  height: 100%; width: 0;
  background: rgba(255, 255, 255, .26);
  transition: none;
  z-index: 1;
}
.tare-hold-btn.holding .tare-progress {
  animation: fillProgress 1s linear forwards;
}
.tare-hold-btn.success { background: #3BA55D !important; border-color: #3BA55D !important; }
.tare-hold-btn.error   { background: #E24B4A !important; border-color: #E24B4A !important; }  /* tare failed (non-2xx / unreachable) */

@keyframes fillProgress {
  from { width: 0%; }
  to   { width: 100%; }
}

/* ── WS Log panel ── */
.scale-card-log:empty { display: none; }

.scale-ws-log {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.swl-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--surface-raised);
}
.swl-summary::-webkit-details-marker { display: none; }
.swl-summary::before {
  content: '▶';
  font-size: 8px;
  transition: transform .15s;
  display: inline-block;
}
.scale-ws-log[open] .swl-summary::before { transform: rotate(90deg); }
.swl-count {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--muted);
}
.swl-pre {
  margin: 0;
  padding: 8px 10px;
  font-size: 10px;
  font-family: 'SF Mono', ui-monospace, monospace;
  line-height: 1.55;
  color: var(--muted);
  background: var(--surface-2);
  overflow-x: auto;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre;
}
.swl-line {
  display: block;
}
.swl-dir {
  display: inline-block;
  width: 14px;
  font-weight: 700;
  text-align: center;
  margin-right: 3px;
}
.swl-dir--rx  { color: var(--success-text); }
.swl-dir--tx  { color: var(--info-text); }
.swl-dir--ev  { color: var(--muted); }
.swl-ts {
  color: var(--muted);
  margin-right: 6px;
  font-size: 9px;
}

/* Live view + Screenshot of the scale's own screen (buttons from tigertouch.css). */
.scale-lan { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scale-lan:empty { display: none; }
