#selection-toolbar {
  position: fixed; z-index: 75; box-sizing: border-box; width: 340px;
  max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto;
  padding: 4px; border: 1px solid #d9e5ee;
  border-radius: 9px; background: #fff; color: #243247;
  box-shadow: 0 6px 20px #23486b14, 0 1px 3px #23486b0a;
  font: 12px/1.25 "Segoe UI", "Microsoft YaHei", sans-serif;
  user-select: none; -webkit-user-select: none;
  animation: none;
}
#selection-toolbar[hidden], #selection-toolbar [hidden] { display: none !important; }
#selection-toolbar .st-row { display: flex; align-items: center; gap: 2px; }
#selection-toolbar .st-row + .st-row { margin-top: 3px; padding-top: 3px; border-top: 1px solid #edf1f6; }
#selection-toolbar button, #selection-toolbar select, #selection-toolbar input {
  box-sizing: border-box; color: inherit; font: inherit; margin: 0;
}
#selection-toolbar button {
  display: inline-flex; justify-content: center; align-items: center; flex: 0 0 26px;
  height: 26px; padding: 2px; border: 0; border-radius: 5px; background: transparent; cursor: pointer;
  white-space: nowrap;
}
#selection-toolbar button:hover { background: #edf4ff; }
#selection-toolbar button[aria-pressed="true"], #selection-toolbar button[aria-expanded="true"] { background: #e3eeff; color: #0758cb; }
#selection-toolbar button[aria-pressed="mixed"] { background: linear-gradient(135deg, #e3eeff 50%, #fff 50%); }
#selection-toolbar :focus-visible { outline: 2px solid #397be7; outline-offset: 1px; }
#selection-toolbar select { min-width: 0; height: 26px; padding: 2px 4px; border: 1px solid #e2ebf3; border-radius: 5px; background: #f6faff; color-scheme: light; text-overflow: ellipsis; }
#selection-toolbar select:hover, #selection-toolbar .st-size:hover { background: #edf6ff; border-color: #c9dff1; }
/* Native select popups inherit the field background in Edge unless options have their own surface. */
#selection-toolbar select option { background: #fff; color: #243247; }
#selection-toolbar select option:checked { background: #e7f2ff; color: #0758cb; }
#selection-toolbar .st-font { flex: 1 1 110px; width: 110px; }
#selection-toolbar .st-style { flex: 1; width: 100px; }
#selection-toolbar .st-size { flex: 0 0 50px; display: flex; align-items: center; height: 26px; border: 1px solid #e2ebf3; border-radius: 5px; background: #f6faff; }
#selection-toolbar .st-size input { width: 34px; min-width: 0; border: 0; background: transparent; padding: 3px; appearance: textfield; }
#selection-toolbar .st-size input::-webkit-inner-spin-button { appearance: none; }
#selection-toolbar .st-size span { color: #8793a3; font-size: 11px; }
#selection-toolbar sup { align-self: flex-start; font-size: 9px; }
#selection-toolbar svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.6; fill: none; }
#selection-toolbar .st-divider { height: 18px; border-left: 1px solid #e1e7ef; margin: 0 2px; }
#selection-toolbar .st-color { flex-direction: column; gap: 1px; }
#selection-toolbar .st-color i { display: block; width: 19px; height: 3px; border-radius: 1px; background: var(--st-color, #ffff00); }
#selection-toolbar .st-color[data-palette="foreColor"] { --st-color: #dc2626; }
#selection-toolbar .st-palette { display: flex; gap: 5px; flex-wrap: wrap; padding-top: 7px; margin-top: 6px; border-top: 1px solid #edf1f6; }
#selection-toolbar .st-swatch { flex-basis: 24px; height: 24px; background: var(--swatch); border: 1px solid #a5b2c6; box-shadow: inset 0 0 0 2px #fff; }
#selection-toolbar .st-clear { flex-basis: 60px; height: 24px; font-size: 12px; }
body.udoc-document-readonly #selection-toolbar, body.udoc-reading-view #selection-toolbar,
body.presenting #selection-toolbar, body.udoc-html-immersive #selection-toolbar,
body.udoc-omni-reading #selection-toolbar { display: none !important; }
@media (max-width: 400px) {
  #selection-toolbar button { flex-basis: 24px; }
  #selection-toolbar .st-row { gap: 2px; }
}
@media print { #selection-toolbar { display: none !important; } }
@media (prefers-reduced-motion: reduce) { #selection-toolbar { animation: none !important; transition: none !important; } }
