/* ============================================================================
 *  wlc-loading.css — loading-state visuals (u_44_load_1)
 *  Namespaced (.u44l-* / .wlc-spinner) so it cannot collide with existing CSS.
 * ==========================================================================*/

/* ---------- boot splash ---------- */
#boot-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg, #0b0f14);
  color: var(--fg, #e6edf3);
  font-family: var(--sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  transition: opacity .3s ease;
}
#boot-splash.u44l-fade { opacity: 0; pointer-events: none; }
.u44l-logo {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--accent, #58a6ff);
  animation: u44lPulse 1.4s ease-in-out infinite;
  text-shadow: 0 0 30px color-mix(in oklab, var(--accent, #58a6ff) 55%, transparent);
}
@keyframes u44lPulse {
  0%, 100% { opacity: .55; transform: scale(.98); }
  50%      { opacity: 1;   transform: scale(1);   }
}
.u44l-dots { display: flex; gap: 7px; }
.u44l-dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent, #58a6ff);
  animation: u44lDot 1.2s ease-in-out infinite;
}
.u44l-dots span:nth-child(2) { animation-delay: .18s; }
.u44l-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes u44lDot {
  0%, 80%, 100% { transform: scale(.4); opacity: .35; }
  40%           { transform: scale(1);  opacity: 1;   }
}
.u44l-boot-text {
  font-size: 13px;
  color: var(--fg-mute, #5b6878);
  letter-spacing: .4px;
}
.u44l-boot-err {
  max-width: 380px;
  padding: 12px 16px;
  background: rgba(231,76,60,.12);
  border: 1px solid rgba(231,76,60,.42);
  border-radius: 8px;
  color: #ff8a80;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}

/* ---------- inline spinner ---------- */
.wlc-spinner {
  display: inline-block;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--accent, #58a6ff) 25%, transparent);
  border-top-color: var(--accent, #58a6ff);
  animation: wlcSpin .75s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes wlcSpin { to { transform: rotate(360deg); } }
.wlc-spinner.u44l-sm { width: 12px; height: 12px; border-width: 1.6px; }
.wlc-spinner.u44l-md { width: 16px; height: 16px; }
.wlc-spinner.u44l-lg { width: 24px; height: 24px; border-width: 3px; }

/* ---------- WS connection pill ---------- */
.u44l-ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--mono, monospace);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .3px;
  background: var(--bg-2, #1a2230);
  border: 1px solid var(--border, #2a3546);
  color: var(--fg-dim, #8b96a5);
  flex: 0 0 auto;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  transition: color .2s, border-color .2s;
}
.u44l-ws-pill .u44l-ws-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--fg-mute, #5b6878);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--fg-mute, #5b6878) 25%, transparent);
  flex: 0 0 auto;
  transition: background .2s, box-shadow .2s;
}
.u44l-ws-pill.is-connecting { color: var(--amber, #f39c12);
  border-color: color-mix(in oklab, var(--amber, #f39c12) 40%, var(--border, #2a3546)); }
.u44l-ws-pill.is-connecting .u44l-ws-dot {
  background: var(--amber, #f39c12);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--amber, #f39c12) 30%, transparent),
              0 0 8px color-mix(in oklab, var(--amber, #f39c12) 60%, transparent);
  animation: u44lPulseDot 1.2s ease-in-out infinite;
}
.u44l-ws-pill.is-online { color: var(--green, #2ecc71);
  border-color: color-mix(in oklab, var(--green, #2ecc71) 40%, var(--border, #2a3546)); }
.u44l-ws-pill.is-online .u44l-ws-dot {
  background: var(--green, #2ecc71);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--green, #2ecc71) 25%, transparent);
}
.u44l-ws-pill.is-offline { color: var(--red, #e74c3c);
  border-color: color-mix(in oklab, var(--red, #e74c3c) 45%, var(--border, #2a3546)); }
.u44l-ws-pill.is-offline .u44l-ws-dot {
  background: var(--red, #e74c3c);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--red, #e74c3c) 30%, transparent),
              0 0 8px color-mix(in oklab, var(--red, #e74c3c) 55%, transparent);
  animation: u44lPulseDot 1.4s ease-in-out infinite;
}
@keyframes u44lPulseDot { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

/* ---------- skeleton shimmer ---------- */
.u44l-sk-bar {
  display: block;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--bg-2, #1a2230) 0%,
    var(--bg-3, #232d3d) 50%,
    var(--bg-2, #1a2230) 100%);
  background-size: 220% 100%;
  animation: u44lShimmer 1.5s linear infinite;
}
@keyframes u44lShimmer {
  0%   { background-position: 220% 0; }
  100% { background-position: -220% 0; }
}

/* ---------- button busy state ---------- */
.btn.u44l-busy { opacity: .75; cursor: progress !important; }
.btn.u44l-busy > .wlc-spinner { margin-right: 6px; }

/* ---------- floating delayed spinner ---------- */
.u44l-delayed-spin {
  position: fixed;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-1, #131923);
  border: 1px solid var(--border, #2a3546);
  border-radius: 8px;
  color: var(--fg, #e6edf3);
  font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}
.u44l-delayed-spin.show { opacity: 1; transform: translateY(0); }


/* u_50_5: migrated from wlc-u46-patch.js */
.u44l-ws-pill{display:none !important;visibility:hidden !important;width:0 !important;height:0 !important;pointer-events:none !important;}
.topbar #topbarDeviceName{display:none !important;}
.topbar #projectNameDisplay{border-width:2px !important;border-style:solid !important;transition:border-color .18s,box-shadow .18s;}
.topbar #projectNameDisplay.ws-offline{border-color:var(--red) !important;border-style:dashed !important;box-shadow:0 0 0 1px var(--red),0 0 12px rgba(231,76,60,.45);}
.topbar #projectNameDisplay.ws-connecting{border-color:var(--amber) !important;border-style:dotted !important;animation:u46Pulse 1.2s ease-in-out infinite;}
@keyframes u46Pulse{0%,100%{box-shadow:0 0 0 1px var(--amber);}50%{box-shadow:0 0 0 4px rgba(243,156,18,.35);}}
.topbar #projectNameDisplay.ws-online.dev-run{border-color:var(--green) !important;box-shadow:0 0 0 1px var(--green),0 0 12px rgba(46,204,113,.45);}
.topbar #projectNameDisplay.ws-online.dev-stop{border-color:var(--amber) !important;box-shadow:0 0 0 1px var(--amber);}
.topbar #projectNameDisplay.ws-online.dev-pause{border-color:var(--amber) !important;box-shadow:0 0 0 1px var(--amber);}
.topbar #projectNameDisplay.ws-online.dev-fault{border-color:var(--red) !important;box-shadow:0 0 0 1px var(--red),0 0 12px rgba(231,76,60,.55);}
.topbar #projectNameDisplay.ws-online.dev-offline{border-color:var(--fg-mute) !important;}
.topbar #projectNameDisplay.ws-online.dev-unpaired{border-color:var(--accent) !important;box-shadow:0 0 0 1px var(--accent);}
.view-toggle.u46-minimal > *{display:none !important;}
.view-toggle.u46-minimal > .toolbar-view-btn{display:inline-flex !important;align-items:center;}
.view-toggle.u46-minimal > #savedIndicator{display:inline-flex !important;margin-left:auto !important;flex-shrink:0;padding-left:14px;}
.u46-trend-toggle{position:absolute;top:50%;transform:translate(-50%,-50%);width:14px;height:52px;padding:0;z-index:60;background:var(--bg-2);border:1px solid var(--border);color:var(--fg-dim);cursor:pointer;display:flex;align-items:center;justify-content:center;font-family:var(--sans);font-size:11px;font-weight:700;line-height:1;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.45);outline:none;}
.u46-trend-toggle:hover{background:var(--accent-2);border-color:var(--accent-2);color:#fff;}
.u46-trend-toggle.collapsed{background:var(--accent-2);border-color:var(--accent);color:#fff;box-shadow:0 0 12px rgba(88,166,255,.75);}
.canvas-wrap > div:not(.sim-toolbar):has(#trendCanvas) > div:first-child{flex:0 0 126px !important;width:126px !important;max-width:126px !important;min-width:0 !important;box-sizing:border-box !important;}
html.u46-trend-hidden-root .canvas-wrap > div:not(.sim-toolbar):has(#trendCanvas) > div:first-child{display:none !important;}
.canvas-wrap > .graph-canvas > .canvas-scroll{width:auto !important;max-width:none !important;min-width:0 !important;}
.u46-mobile-trend-toggle{flex:0 0 auto;padding:6px 12px;font-size:12px;font-weight:600;background:var(--bg-2);color:var(--fg);border:1px solid var(--border);border-radius:6px;cursor:pointer;white-space:nowrap;min-height:34px;}
.u46-mobile-trend-toggle:hover{background:var(--bg-3);}
.u46-mobile-trend-toggle.collapsed{background:var(--accent-2);border-color:var(--accent);color:#fff;}
.wlc-py-editor .wlc-py-pre,.wlc-py-editor .wlc-py-ta{-webkit-font-smoothing:antialiased !important;font-kerning:none !important;font-variant-ligatures:none !important;font-variant-numeric:normal !important;font-feature-settings:normal !important;text-shadow:none !important;hyphens:none !important;-webkit-hyphens:none !important;}
.wlc-py-editor .wlc-py-pre{overflow:hidden !important;}
.u46-files-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--border);}
.u46-selcount{font-family:var(--mono);font-size:11.5px;color:var(--accent);margin-left:auto;}
.u46-file-row{cursor:pointer;user-select:none;-webkit-user-select:none;}
.u46-file-row.u46-selected{background:color-mix(in oklab,var(--accent) 16%,var(--bg-2)) !important;border-color:var(--accent) !important;}
.u46-file-list{min-height:80px;padding:4px;border-radius:8px;}
.u46-file-row .btn.sm{min-width:0;padding:5px 10px;font-size:11.5px;}
:root{--bank-A:#2dd4bf;--bank-E:#a78bfa;}
.sim-io-group.bank-D{border-left:3px solid var(--bank-D) !important;}
.sim-io-group.bank-E{border-left:3px solid var(--bank-E) !important;}
.sim-io-group.bank-F{border-left:3px solid var(--bank-F) !important;}
.sim-io-group.bank-D .sim-io-label{color:var(--bank-D) !important;}
.sim-io-group.bank-E .sim-io-label{color:var(--bank-E) !important;}
.sim-io-group.bank-F .sim-io-label{color:var(--bank-F) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="D"]{color:var(--bank-D) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="E"]{color:var(--bank-E) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="F"]{color:var(--bank-F) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="D"]:focus{border-color:var(--bank-D) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="E"]:focus{border-color:var(--bank-E) !important;}
.sim-io-bar input.sim-io-analog[data-addr^="F"]:focus{border-color:var(--bank-F) !important;}
.sim-io-group .sim-io-word-wrap{display:contents !important;}
.sim-io-group .sim-io-word-label{display:none !important;}
@media (max-width:900px){
.u46-trend-toggle{display:none !important;}
.u46-mobile-trend-toggle{display:inline-flex;align-items:center;gap:4px;}
.canvas-wrap > div:not(.sim-toolbar):has(#trendCanvas) > div:first-child{flex:0 0 108px !important;width:108px !important;max-width:108px !important;}
.wlc-py-editor{--py-lh:22px;}
.wlc-py-editor .wlc-py-pre,.wlc-py-editor .wlc-py-ta{font-size:16px !important;line-height:22px !important;padding:6px 10px !important;letter-spacing:0 !important;word-spacing:0 !important;-webkit-text-size-adjust:100% !important;text-size-adjust:100% !important;}
.wlc-py-editor .wlc-py-ln{font-size:13px !important;line-height:22px !important;}
.u46-file-row{flex-direction:column;align-items:stretch;gap:6px;}
.u46-file-row .fname{white-space:normal;word-break:break-all;}
.u46-file-row .btn.sm{width:100%;}
.sim-io-bar{flex-wrap:nowrap !important;overflow-x:auto !important;overflow-y:hidden !important;-webkit-overflow-scrolling:touch;}
.sim-io-group{flex-wrap:nowrap !important;flex:0 0 auto !important;}
}
@media (min-width:901px){.u46-mobile-trend-toggle{display:none !important;}}


/* u_50_8: mobile avatar for the account chip
 * -------------------------------------------------------------------------
 *  On mobile the account chip (button.uipro-user-btn) is ~110 px wide
 *  because of its three visible children — name, role pill, chevron.
 *  This block collapses it to a 36 px circular avatar showing only the
 *  first letter of the username.  Desktop is untouched.
 *
 *  The <span class="uipro-avatar"> inside each chip is inserted by the
 *  sweeper IIFE that u_50_8 appends to wlc-topbar-pro.js.
 * ------------------------------------------------------------------------*/

/* The avatar element exists on every chip, but is hidden on desktop. */
button.uipro-user-btn > .uipro-avatar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg,
      color-mix(in oklab, var(--accent) 85%, white),
      var(--accent-2));
  border-radius: 50%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px) {
  /* Collapse the chip to a fixed 36 px circle. */
  .topbar         button.uipro-user-btn,
  .manager-topbar button.uipro-user-btn,
  .admin-topbar   button.uipro-user-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    transition: transform .10s ease;
  }
  /* Hide every child of the chip … */
  .topbar         button.uipro-user-btn > *:not(.uipro-avatar),
  .manager-topbar button.uipro-user-btn > *:not(.uipro-avatar),
  .admin-topbar   button.uipro-user-btn > *:not(.uipro-avatar) {
    display: none !important;
  }
  /* … except the avatar, which becomes the entire visible chip. */
  .topbar         button.uipro-user-btn > .uipro-avatar,
  .manager-topbar button.uipro-user-btn > .uipro-avatar,
  .admin-topbar   button.uipro-user-btn > .uipro-avatar {
    display: inline-flex !important;
  }
  /* Kill the desktop hover background so nothing squares off behind
     the circle; use a tiny scale for tactile feedback instead. */
  .topbar         button.uipro-user-btn:hover,
  .manager-topbar button.uipro-user-btn:hover,
  .admin-topbar   button.uipro-user-btn:hover {
    background: transparent;
    border-color: transparent;
    transform: scale(1.06);
  }
  .topbar         button.uipro-user-btn:active,
  .manager-topbar button.uipro-user-btn:active,
  .admin-topbar   button.uipro-user-btn:active {
    transform: scale(0.94);
  }
  /* Keyboard focus ring drawn around the circle. */
  .topbar         button.uipro-user-btn:focus-visible,
  .manager-topbar button.uipro-user-btn:focus-visible,
  .admin-topbar   button.uipro-user-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 50%;
  }
}

@media (max-width: 420px) {
  .topbar         button.uipro-user-btn,
  .manager-topbar button.uipro-user-btn,
  .admin-topbar   button.uipro-user-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
  }
  button.uipro-user-btn > .uipro-avatar { font-size: 13px; }
}


/* u_50_9: circle hardening for the mobile account avatar
 * -------------------------------------------------------------------------
 *  u_50_8 pinned the chip button at width:36 / height:36 and the avatar
 *  span at width:100% / height:100%.  In practice the button is a flex
 *  item of .topbar, so `min-height: auto` lets it grow taller than 36 px
 *  the moment anything inside it contributes more height — which turns
 *  the 50% border-radius into an ellipse.
 *
 *  This block makes squareness non-negotiable:
 *    • aspect-ratio: 1/1 on the button (square even if height is
 *      stretched by a parent)
 *    • align-self: center + flex: 0 0 36px (opt out of any stretching)
 *    • min-height: 0 (defeat the flex-item `auto` minimum)
 *    • padding / margin / border explicitly zeroed
 *    • the avatar span is absolutely positioned inside the button with
 *      inset: 0, so it fills the button's padding box exactly — no
 *      percentage arithmetic involved.
 *
 *  Result: 36 × 36 button, 36 × 36 span, 50% radius → perfect circle.
 *  On the 32-px breakpoint (≤ 420 px) it scales down in step.
 * ------------------------------------------------------------------------*/

@media (max-width: 900px) {

  .topbar         button.uipro-user-btn,
  .manager-topbar button.uipro-user-btn,
  .admin-topbar   button.uipro-user-btn {
    /* Square, always. */
    width:           36px     !important;
    height:          36px     !important;
    min-width:       36px     !important;
    min-height:      0        !important;
    max-width:       36px     !important;
    max-height:      36px     !important;
    aspect-ratio:    1 / 1    !important;

    /* Opt out of flex stretching along the cross axis. */
    align-self:      center   !important;
    flex:            0 0 36px !important;

    /* Zero out anything that could shift the content box. */
    padding:         0        !important;
    margin:          0        !important;
    border:          0        !important;
    box-sizing:      border-box !important;

    /* The visible shape. */
    border-radius:   50%      !important;
    overflow:        hidden   !important;
    background:      transparent !important;

    /* Position context for the absolutely-positioned span. */
    position:        relative !important;

    /* Flex alignment for any residual children. */
    display:         inline-flex !important;
    align-items:     center   !important;
    justify-content: center   !important;
    gap:             0        !important;
    line-height:     1        !important;
    font-size:       12px     !important;
  }

  /* Avatar fills the button's padding box exactly. */
  .topbar         button.uipro-user-btn > .uipro-avatar,
  .manager-topbar button.uipro-user-btn > .uipro-avatar,
  .admin-topbar   button.uipro-user-btn > .uipro-avatar {
    display:         flex     !important;
    align-items:     center   !important;
    justify-content: center   !important;

    position:        absolute !important;
    top:             0        !important;
    right:           0        !important;
    bottom:          0        !important;
    left:            0        !important;

    width:           auto     !important;
    height:          auto     !important;
    min-width:       0        !important;
    min-height:      0        !important;
    max-width:       none     !important;
    max-height:      none     !important;

    padding:         0        !important;
    margin:          0        !important;
    border:          0        !important;
    box-sizing:      border-box !important;

    border-radius:   50%      !important;
    line-height:     1        !important;
    font-size:       14px     !important;
    font-weight:     800      !important;
    letter-spacing:  0        !important;
  }

  /* Any child that is NOT the avatar stays out of layout entirely —
     belt and braces in case a future chip grows a new span. */
  .topbar         button.uipro-user-btn > *:not(.uipro-avatar),
  .manager-topbar button.uipro-user-btn > *:not(.uipro-avatar),
  .admin-topbar   button.uipro-user-btn > *:not(.uipro-avatar) {
    display: none !important;
  }

  /* Kill the desktop hover background so nothing squares off behind
     the circle; a tiny scale gives the tap feedback instead. */
  .topbar         button.uipro-user-btn:hover,
  .manager-topbar button.uipro-user-btn:hover,
  .admin-topbar   button.uipro-user-btn:hover {
    background:   transparent !important;
    border-color: transparent !important;
    transform:    scale(1.06);
  }
  .topbar         button.uipro-user-btn:active,
  .manager-topbar button.uipro-user-btn:active,
  .admin-topbar   button.uipro-user-btn:active {
    transform:    scale(0.94);
  }
  .topbar         button.uipro-user-btn:focus-visible,
  .manager-topbar button.uipro-user-btn:focus-visible,
  .admin-topbar   button.uipro-user-btn:focus-visible {
    outline:        2px solid var(--accent);
    outline-offset: 2px;
    border-radius:  50% !important;
  }
}

@media (max-width: 420px) {
  .topbar         button.uipro-user-btn,
  .manager-topbar button.uipro-user-btn,
  .admin-topbar   button.uipro-user-btn {
    width:           32px     !important;
    height:          32px     !important;
    min-width:       32px     !important;
    max-width:       32px     !important;
    max-height:      32px     !important;
    flex:            0 0 32px !important;
  }
  .topbar         button.uipro-user-btn > .uipro-avatar,
  .manager-topbar button.uipro-user-btn > .uipro-avatar,
  .admin-topbar   button.uipro-user-btn > .uipro-avatar {
    font-size: 13px !important;
  }
}


/* ===== u_50f_1 BEGIN ===== */
/* -----------------------------------------------------------------------------
 * Themed scrollbars.
 *
 * Every colour below is a theme variable.  Switching themes updates the
 * variables on <html data-theme="…">, and the browser re-paints the
 * scrollbars automatically — no JavaScript involved.
 *
 * The WebKit / Blink thumb rules use !important so they win against
 * the hand-written scrollbar rules already present in style.css and
 * wlc-py-editor.css.  Those earlier rules pre-date this patch and are
 * not theme-aware; without !important they would keep their fixed
 * greys and the theme follow-through would not work.
 *
 * Elements that intentionally hide their scrollbars — the topbar, the
 * editor-tabs strip, the modal-tabs strip, the filter-chips strip,
 * the Python textarea's highlight overlay, the palette search field —
 * declare their hidden scrollbars with class-prefixed selectors,
 * which have higher specificity than the universal selectors below
 * for the `display` property, so those stay hidden exactly as before.
 * -------------------------------------------------------------------------- */

/* ---------- WebKit / Blink — default track size --------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: transparent;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Floating pill: 2px transparent border + background-clip: padding-box
   produces a rounded 6-px-wide thumb inside a 10-px-wide track.  The
   thumb sits over the content, modern-browser style. */
::-webkit-scrollbar-thumb {
  background-color: color-mix(in oklab, var(--fg-mute) 55%, transparent) !important;
  background-image: none !important;
  background-clip: padding-box !important;
  border: 2px solid transparent !important;
  border-radius: 999px !important;
}

::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in oklab, var(--accent) 72%, transparent) !important;
}

::-webkit-scrollbar-thumb:active {
  background-color: var(--accent) !important;
}

/* Hide the increment / decrement arrow buttons some platforms draw. */
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* ---------- Light themes: bump thumb opacity for contrast on white -------- */
[data-theme="light"]     ::-webkit-scrollbar-thumb,
[data-theme="porcelain"] ::-webkit-scrollbar-thumb,
[data-theme="sage"]      ::-webkit-scrollbar-thumb {
  background-color: color-mix(in oklab, var(--fg-mute) 72%, transparent) !important;
}

/* ---------- Narrow custom tracks ----------------------------------------- *
 * The HMI palette and side panel ship with 4-px and 6-px tracks that
 * would collapse to 0 px visible width under the 2-px thumb border
 * above.  A 1-px border keeps a real pill visible at those sizes.
 * -------------------------------------------------------------------------- */
.io-hmi-pal-list::-webkit-scrollbar-thumb,
.io-hmi-side::-webkit-scrollbar-thumb {
  border-width: 1px !important;
}

/* ---------- Firefox ------------------------------------------------------ *
 * scrollbar-color and scrollbar-width are both inherited properties,
 * so a single declaration on <html> covers every scroll container in
 * the document.  Elements that declare `scrollbar-width: none` — the
 * topbar, the editor-tabs strip, the Python overlay — keep their
 * hidden scrollbars, because a direct declaration always beats an
 * inherited value.
 * -------------------------------------------------------------------------- */
html {
  scrollbar-width: thin;
  scrollbar-color:
    color-mix(in oklab, var(--fg-mute) 55%, transparent)
    transparent;
}

[data-theme="light"],
[data-theme="porcelain"],
[data-theme="sage"] {
  scrollbar-color:
    color-mix(in oklab, var(--fg-mute) 72%, transparent)
    transparent;
}
/* ===== u_50f_1 END ===== */

/* ===== u_50j_6 BEGIN =====
 * Smaller corner resize handles for HMI objects.
 * Effective size in the previous cascade was 20 x 20 px with -7 px
 * offsets.  Halved to 10 x 10 px, with -5 px offsets so each handle
 * is centred on its corner.  box-sizing:border-box is set globally,
 * so the border is included in the 10 px measurement.
 */
.io-hmi-obj .io-hmi-obj-resize {
  width: 10px !important;
  height: 10px !important;
  border-width: 2px !important;
  border-radius: 2px !important;
}
.io-hmi-obj .io-hmi-resize-nw { top: -5px;    left: -5px;  }
.io-hmi-obj .io-hmi-resize-ne { top: -5px;    right: -5px; }
.io-hmi-obj .io-hmi-resize-sw { bottom: -5px; left: -5px;  }
.io-hmi-obj .io-hmi-resize-se { bottom: -5px; right: -5px; }
/* ===== u_50j_6 END ===== */

/* ==== u_50p3_1 BEGIN ==== */
@media (max-width: 900px) {
  .io-modebar {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    gap: 6px !important;
    padding: 6px 8px !important;
  }
  .io-modebar > * { flex: 0 0 auto !important; }
  .io-modebar > .spacer { display: none !important; }
  .io-modebar .hmi-file-name-display,
  .io-modebar > .hmi-file-name-display {
    max-width: none !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    width: auto !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    font-size: 12px !important;
    padding: 4px 10px !important;
    margin: 0 4px !important;
  }
  .io-modebar::-webkit-scrollbar { height: 4px; }
  .io-modebar::-webkit-scrollbar-thumb {
    background: rgba(139,150,165,.35);
    border-radius: 2px;
  }
}
/* ==== u_50p3_1 END ==== */
