/* LibreOfficeSheet mount — Neuronis; двухрядная chrome-панель Colibre + скрытая нативная libreoffice-toolbar */

/* Сужённое окно (60vw): слева в колонке виджета; на странице LibreOfficeSheet — вровень с левым краем вьюпорта см. index.html */
.calc-widget--libreoffice-sheet > .libreoffice-sheet-calc-container.univer-calc--restored {
  align-self: flex-start;
  margin-left: 0;
  margin-right: auto;
}

.libreoffice-sheet-calc-container .libreoffice-sheet-calc-mount {
  flex: 1;
  min-height: 360px;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.libreoffice-sheet-calc-container .libreoffice-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.libreoffice-sheet-calc-container .libreoffice-workarea {
  flex-shrink: 0;
}

/*
 * Colibre: чёрная полоса заголовка и серая строка меню.
 * Flex-ряд пункта «Файл»/«Правка» — в т.ч. из univer_calc.css; z-index chrome над листом — блок выше.
 */
.libreoffice-sheet-calc-container .univer-libre-title-bar {
  flex-shrink: 0;
  height: 22px;
  padding: 0 4px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #000;
  color: #e0e0e0;
  font-size: 12px;
  font-family: Liberation Sans, Arial, sans-serif;
  line-height: 1;
}

.libreoffice-sheet-calc-container .univer-libre-title-bar__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .univer-libre-title-bar__actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  gap: 2px;
  margin-left: 6px;
}

.libreoffice-sheet-calc-container .univer-libre-title-bar__winbtn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-left: 0;
  background: transparent;
  border: none;
  border-radius: 2px;
  color: #c0c0c0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.libreoffice-sheet-calc-container .univer-libre-title-bar__winbtn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.libreoffice-sheet-calc-container .univer-winbtn-icon {
  width: 12px;
  height: 12px;
  display: block;
}

.libreoffice-sheet-calc-container .univer-stmt-full-icon {
  width: 12px;
  height: 12px;
  display: block;
}

.libreoffice-sheet-calc-container .univer-winbtn-icon--maximize {
  display: none;
}

.libreoffice-sheet-calc-container .univer-winbtn-icon--restore {
  display: block;
}

.libreoffice-sheet-calc-container.univer-calc--restored .univer-winbtn-icon--maximize {
  display: block;
}

.libreoffice-sheet-calc-container.univer-calc--restored .univer-winbtn-icon--restore {
  display: none;
}

.libreoffice-sheet-calc-container .univer-libre-menu-bar {
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: 26px;
  height: 26px;
  padding: 0 4px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  background: #3c3c3c;
  color: #e0e0e0;
  font-size: 12px;
  font-family: Liberation Sans, Arial, sans-serif;
  line-height: 1;
}

.libreoffice-sheet-calc-container .univer-libre-menu-bar::-webkit-scrollbar {
  height: 4px;
}

.libreoffice-sheet-calc-container .univer-libre-menu-bar::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-title-bar {
  background: #f0f0f0;
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-title-bar__winbtn {
  color: #444;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-title-bar__winbtn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-menu-bar {
  background: #f2f2f2;
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-menu-bar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .univer-libre-title-bar,
[data-theme="dark"] .libreoffice-sheet-calc-container .univer-libre-title-bar {
  background: #202020;
  color: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .univer-libre-menu-bar,
[data-theme="dark"] .libreoffice-sheet-calc-container .univer-libre-menu-bar {
  background: #202020;
  color: #e8e8e8;
}

/* Нижняя полоса вкладок («Лист1»): меньше вертикального воздуха (override libreoffice_sheet_app.css) */
.libreoffice-sheet-calc-container .luckysheet-sheet-area {
  height: 25px;
  min-height: 25px;
  padding: 0 24px 0 36px;
}

.libreoffice-sheet-calc-container .luckysheet-sheet-area div.luckysheet-sheets-item {
  height: 23px;
  line-height: 23px;
  padding: 0 16px 0 4px;
  font-size: 12px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .luckysheet-sheet-area div.luckysheet-sheets-item .luckysheet-sheets-item-menu {
  height: 100%;
  top: 0;
}

.libreoffice-sheet-calc-container .luckysheet-sheet-area div.luckysheet-sheets-item-active {
  height: 23px;
  line-height: 23px;
}

.libreoffice-sheet-calc-container .libreoffice-sheettab-button,
.libreoffice-sheet-calc-container .libreoffice-sheettab-button:hover {
  height: 23px;
  width: 23px;
}

/* Горизонтальный скролл тоньше в 2×; вертикальный — прежняя ширина 8px (WebKit) */
.libreoffice-sheet-calc-container .luckysheet-scrollbar-ltr {
  scrollbar-width: thin;
  scrollbar-color: #babac0 transparent;
}

.libreoffice-sheet-calc-container .luckysheet-scrollbar-ltr::-webkit-scrollbar {
  width: 8px;
  height: 4px;
}

.libreoffice-sheet-calc-container .luckysheet-scrollbar-ltr::-webkit-scrollbar-thumb {
  border-radius: 4px;
}

/* Полоса под вкладками «Лист1»: в vendor фиксированная height: 22px даже без СЧЁТ/СУММА — убираем пустой зазор */
.libreoffice-sheet-calc-container .libreoffice-stat-area {
  min-height: 0;
}

.libreoffice-sheet-calc-container .luckysheet-sheet-selection-calInfo:empty {
  height: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

@supports selector(:has(*)) {
  .libreoffice-sheet-calc-container .luckysheet-sheet-selection-calInfo:not(:has(> *)) {
    height: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }
}

/* Нативная панель LibreOfficeSheet: только программные клики (дублирует верхние SVG-кнопки) */
.libreoffice-sheet-calc-container .libreoffice-toolbar {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-toolbar-divider {
  background-color: #b0b0b0;
  height: 22px;
  margin: 0 5px;
}

.libreoffice-sheet-calc-container .libreoffice-toolbar-button,
.libreoffice-sheet-calc-container .libreoffice-toolbar-combo {
  border-radius: 2px;
  margin: 1px 2px;
  border: 1px solid transparent;
}

.libreoffice-sheet-calc-container .libreoffice-toolbar-button:hover,
.libreoffice-sheet-calc-container .libreoffice-toolbar-combo:hover {
  background-color: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.12);
}

.libreoffice-sheet-calc-container .libreoffice-toolbar-button:active,
.libreoffice-sheet-calc-container .libreoffice-toolbar-combo:active {
  background-color: rgba(0, 0, 0, 0.14);
}

.libreoffice-sheet-calc-container .libreoffice-toolbar-combo-popup {
  background: #f5f5f5;
  border: 1px solid #b0b0b0;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.15);
}

/* Два ряда кнопок LibreOffice Colibre над монтированием */
.libreoffice-sheet-calc-container .libreoffice-lo-toolbar.univer-libre-toolbar--buttons {
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
}

/*
 * Chrome (title / menubar / toolbar) и mount — соседние flex-элементы; выпадающие меню выходят вниз.
 * Внутри Univer canvas/оверлеи до ~1080 — без слоя Colibre меню границ и клики оказываются под листом.
 * Menubar выше toolbar (1250 > 1200), чтобы «Файл»/«Правка» не перекрывались полосой кнопок при наложении.
 */
.libreoffice-sheet-calc-container > .univer-libre-title-bar {
  position: relative;
  z-index: 1180;
}

.libreoffice-sheet-calc-container > .libreoffice-lo-menubar {
  position: relative;
  z-index: 1250;
}

/* HyperFormula / Colibre: строка «Файл»/«Правка» без класса libreoffice-lo-menubar — иначе
 * панель инструментов (1200) перекрывает calc-menu-dropdown (выпадающее меню). */
.libreoffice-sheet-calc-container > .univer-libre-menu-bar.calc-menu-menubar {
  position: relative;
  z-index: 1250;
}

/* HyperFormula calc-меню (Файл…Данные): как у .libreoffice-lo-menubar-item--popup — не сжимать во flex-ряду,
 * иначе подписи исчезают или оказываются под панелью иконок при узком окне. */
.libreoffice-sheet-calc-container > .univer-libre-menu-bar.calc-menu-menubar .calc-menu-container {
  flex: 0 0 auto;
  min-width: max-content;
}

.libreoffice-sheet-calc-container > .univer-libre-toolbar.libreoffice-lo-toolbar {
  position: relative;
  z-index: 1200;
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  min-height: 34px;
  padding: 2px 8px 2px 10px;
  column-gap: 6px;
  row-gap: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.22);
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__row--format {
  border-bottom: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__sep {
  flex: none;
  width: 1px;
  align-self: center;
  height: 22px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.2);
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__btn:disabled,
.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

/* Скрытый input вне экрана — legacy; для Chrome/Edge палитра не открывается */
.libreoffice-sheet-calc-container .libreoffice-lo-color-input-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 0;
  opacity: 0;
}

/* Палитра: input поверх ▾ — нативный клик в зоне user gesture (Chrome/Edge) */
.libreoffice-sheet-calc-container .libreoffice-lo-color-picker-host {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-color-input-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.libreoffice-sheet-calc-container .libreoffice-lo-color-picker-host .univer-border-split__chevron {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__btn img {
  width: 24px;
  height: 24px;
  max-height: 24px;
  display: block;
}

/* lc_color: нижняя полоска = текущий цвет текста выделения (--libreoffice-lo-fc-swatch задаётся из JS) */
.libreoffice-sheet-calc-container .libreoffice-lo-font-color-btn__svg {
  display: block;
  width: 24px;
  height: 24px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-glyph {
  fill: #3a3a38;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-glyph {
  fill: #fafafa;
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-bar {
  fill: var(--libreoffice-lo-fc-swatch, #000000);
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-split {
  flex: none;
  align-self: center;
  --libreoffice-lo-fc-swatch: #000000;
  border-radius: 2px;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .libreoffice-lo-toolbar__btn {
  min-height: 24px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .univer-border-split__toggle {
  min-width: 20px !important;
  width: 20px !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .univer-border-split__chevron {
  font-size: 14px;
  line-height: 1;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-split:hover {
  border-color: #7eb4ea;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .libreoffice-lo-toolbar__btn:hover,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .libreoffice-lo-toolbar__btn:focus-visible {
  background: #cce8ff !important;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .libreoffice-lo-toolbar__btn:hover,
html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-font-color-split .libreoffice-lo-toolbar__btn:focus-visible {
  background: rgba(255, 255, 255, 0.14) !important;
}

/* lc_backgroundcolor: нижняя полоска = текущий цвет заливки (--libreoffice-lo-bg-swatch из JS) */
.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-btn__svg {
  display: block;
  width: 24px;
  height: 24px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-bar {
  fill: var(--libreoffice-lo-bg-swatch, #ffffff);
}

.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split {
  flex: none;
  align-self: center;
  --libreoffice-lo-bg-swatch: #ffffff;
  border-radius: 2px;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .libreoffice-lo-toolbar__btn {
  min-height: 24px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .univer-border-split__toggle {
  min-width: 20px !important;
  width: 20px !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .univer-border-split__chevron {
  font-size: 14px;
  line-height: 1;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split:hover {
  border-color: #7eb4ea;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .libreoffice-lo-toolbar__btn:hover,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .libreoffice-lo-toolbar__btn:focus-visible {
  background: #cce8ff !important;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .libreoffice-lo-toolbar__btn:hover,
html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-split .libreoffice-lo-toolbar__btn:focus-visible {
  background: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-bucket path[fill="#3a3a38"] {
  fill: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-fill-color-bucket path[stroke="#3a3a38"] {
  stroke: #cfcfcf;
}

.libreoffice-sheet-calc-container .libreoffice-lo-toolbar__border-split {
  flex: none;
}

.libreoffice-sheet-calc-container [data-libreoffice-border-style-menu] {
  min-width: 168px;
  max-height: 290px;
  overflow-y: auto;
}

.libreoffice-sheet-calc-container .univer-border-menu__title {
  padding: 8px 10px 6px;
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.85;
}

.libreoffice-sheet-calc-container .univer-border-menu__item--style {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
}

.libreoffice-sheet-calc-container .univer-border-menu__item--style.is-active {
  background: rgba(255, 255, 255, 0.12);
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview {
  display: block;
  width: 132px;
  height: 0;
  border-top: 1px solid currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--thin-solid {
  border-top: 1px solid currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--medium-solid {
  border-top: 2px solid currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--thick-solid {
  border-top: 3px solid currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--double {
  border-top: 3px double currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--thin-dashed {
  border-top: 1px dashed currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--medium-dashed {
  border-top: 2px dashed currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--thick-dashed {
  border-top: 3px dashed currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--thin-dotted {
  border-top: 1px dotted currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--medium-dotted {
  border-top: 2px dotted currentColor;
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--dash-dot {
  height: 2px;
  border-top: none;
  background: repeating-linear-gradient(
    to right,
    currentColor 0 9px,
    transparent 9px 13px,
    currentColor 13px 15px,
    transparent 15px 21px
  );
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--dash-dot-dot {
  height: 2px;
  border-top: none;
  background: repeating-linear-gradient(
    to right,
    currentColor 0 8px,
    transparent 8px 12px,
    currentColor 12px 14px,
    transparent 14px 16px,
    currentColor 16px 18px,
    transparent 18px 24px
  );
}

.libreoffice-sheet-calc-container .univer-border-menu__style-preview--long-dash {
  border-top: 2px dashed currentColor;
  border-image: repeating-linear-gradient(
      to right,
      currentColor 0 14px,
      transparent 14px 22px
    )
    1;
}

.libreoffice-sheet-calc-container .univer-border-menu__divider {
  height: 1px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.18);
}

/* Шрифт и кегль (стиль Colibre / Calc): поле + серая зона со стрелкой */
.libreoffice-sheet-calc-container .libreoffice-lo-combos {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-combo {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  height: 24px;
  margin: 0;
  padding: 2px 22px 2px 6px;
  border: 1px solid #8b8b8b;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.2;
  color: #1a1a1a;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23333' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"),
    linear-gradient(to bottom, #f3f3f3, #dedede);
  background-size: 10px 6px, 22px 100%;
  background-position: right 5px center, right center;
  background-repeat: no-repeat, no-repeat;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-combo:focus {
  outline: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-combo:focus-visible {
  outline: 1px solid rgba(100, 150, 255, 0.9);
  outline-offset: 1px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-combo--font {
  min-width: 132px;
  width: min(200px, 28vw);
  max-width: 240px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-combo--size {
  width: 4.6rem;
  min-width: 4.6rem;
  flex-shrink: 0;
}

/*
 * Светлая тема страницы (html data-theme из theme.js): светлый фон только у полос с
 * кнопками LibreOffice / Colibre. Фон листа (.libreoffice-sheet-calc-mount) не трогаем.
 */
html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-toolbar {
  background: #f2f2f2;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-toolbar-buttons .univer-libre-toolbar-btn--icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-libre-toolbar-buttons .univer-libre-toolbar-btn--icon:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.25);
  outline-offset: -1px;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-toolbar__sep {
  background: rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-toolbar__row {
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-split__chevron {
  color: #444;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-split__toggle {
  border-left-color: rgba(0, 0, 0, 0.18) !important;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-menu {
  border-color: #c9c9c9;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-menu__item {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-menu__item:hover {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-menu__item--style.is-active {
  background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .univer-border-menu__divider {
  background: rgba(0, 0, 0, 0.16);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-combo {
  border-color: #a8a8a8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23222' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"),
    linear-gradient(to bottom, #ececec, #d8d8d8);
}

/* Выпадающие меню строки меню (Файл, Правка): иконки Colibre + подпись + шорткат */
.libreoffice-sheet-calc-container .libreoffice-lo-menubar-item--popup {
  position: relative;
  flex: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-trigger {
  margin: 0;
  padding: 4px 8px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  font-family: Liberation Sans, Arial, sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-trigger:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.5);
  outline-offset: -1px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 280px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  border: 1px solid #555;
  background: #2d2d2d;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  margin: 0;
  padding: 5px 12px 5px 10px;
  border: none;
  background: transparent;
  color: #f0f0f0;
  text-align: left;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
  font-family: Liberation Sans, Arial, sans-serif;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__icon {
  width: 16px;
  height: 16px;
  display: block;
  justify-self: center;
  object-fit: contain;
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__icon-slot {
  width: 16px;
  height: 16px;
  justify-self: center;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__label {
  min-width: 0;
  text-align: left;
  justify-self: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:focus-visible:not(:disabled) {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: -2px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item--disabled,
.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:disabled {
  opacity: 0.45;
  cursor: default;
  color: #f0f0f0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item--disabled:hover,
.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:disabled:hover {
  background: transparent;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__sep {
  height: 1px;
  margin: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-kbd {
  flex: none;
  opacity: 0.65;
  font-size: 11px;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-kbd--arrow {
  justify-self: end;
  opacity: 0.55;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__submenu-host {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 3px;
  min-width: 220px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
  border: 1px solid #555;
  background: #2d2d2d;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-submenu[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item--submenu-parent {
  width: 100%;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__check {
  justify-self: center;
  width: 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.9;
}

.libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item--check {
  grid-template-columns: 22px 1fr auto;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-trigger:hover {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-trigger:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup {
  border-color: #c9c9c9;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:focus-visible:not(:disabled) {
  outline: 1px solid rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item--disabled,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__item:disabled {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__sep {
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-submenu {
  border-color: #c9c9c9;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-submenu {
  border-color: #555;
  background: #2d2d2d;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup {
  border-color: #555;
  background: #2d2d2d;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-menubar-popup__sep {
  background: rgba(255, 255, 255, 0.12);
}

/* Диалог «Сортировка» — макет как у LibreOffice Calc (sort.png) */
.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(620px, 96vw);
  max-height: min(92vh, 720px);
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  background: #1e1e1e;
  color: #f0f0f0;
  font-family: Liberation Sans, Arial, sans-serif;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid #333;
  background: #252525;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__x {
  margin: 0;
  padding: 2px 10px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #ccc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__x:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__body {
  display: flex;
  flex-direction: row;
  min-height: 0;
  flex: 1;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav {
  flex: 0 0 32%;
  min-width: 150px;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  border-right: 1px solid #333;
  background: #1a1a1a;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 12px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #e0e0e0;
  font: inherit;
  font-size: 12px;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn img,
.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-icon {
  flex-shrink: 0;
  opacity: 0.92;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn--active {
  border-color: #2a4f8a;
  background: #1a3a6e;
  color: #fff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__main {
  flex: 1;
  min-width: 0;
  padding: 14px 16px 12px;
  overflow: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-keys {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 140px) auto;
  gap: 10px 12px;
  align-items: start;
}

@media (max-width: 520px) {
  .libreoffice-sheet-calc-container .libreoffice-lo-sort-key-row {
    grid-template-columns: 1fr;
  }
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-key-label {
  padding-top: 4px;
  color: #ccc;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-key-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-key-field__cap {
  font-size: 12px;
  color: #bbb;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-select {
  box-sizing: border-box;
  width: 100%;
  max-width: 140px;
  height: 26px;
  padding: 2px 8px;
  border: 1px solid #555;
  border-radius: 2px;
  background: #2d2d2d;
  color: #f0f0f0;
  font: inherit;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-key-dir {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 18px;
  white-space: nowrap;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-radio input {
  margin: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-sep {
  border: none;
  border-top: 1px solid #3a3a3a;
  margin: 16px 0 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-params {
  margin: 0;
  padding: 0;
  border: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-params__legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: 12px;
  color: #bbb;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-direction {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-direction__title {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 2px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-options-note {
  margin: 0;
  line-height: 1.45;
  color: #c8c8c8;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #333;
  background: #222;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn {
  min-width: 88px;
  margin: 0;
  padding: 6px 14px;
  border: 1px solid #555;
  border-radius: 2px;
  background: linear-gradient(to bottom, #3a3a3a, #2e2e2e);
  color: #f0f0f0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn:hover {
  background: linear-gradient(to bottom, #444, #353535);
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn--primary {
  border-color: #4a6a9a;
  background: linear-gradient(to bottom, #2a5080, #1e4070);
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn--primary:hover {
  background: linear-gradient(to bottom, #325a90, #244a80);
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn--ghost {
  min-width: auto;
  border-color: transparent;
  background: transparent;
  color: #8ab4ff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__window {
  border-color: #b0b0b0;
  background: #f5f5f5;
  color: #1a1a1a;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__titlebar {
  background: #ebebeb;
  border-bottom-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__x {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav {
  background: #e8e8e8;
  border-right-color: #c8c8c8;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn {
  color: #222;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__nav-btn--active {
  border-color: #4a7ac8;
  background: #d0e0f8;
  color: #0a0a0a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-select {
  border-color: #a8a8a8;
  background: #fff;
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-key-label,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-key-field__cap,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-params__legend,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-direction__title {
  color: #444;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-sep {
  border-top-color: #ccc;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__footer {
  background: #ebebeb;
  border-top-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn {
  border-color: #a0a0a0;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-dialog__btn--primary {
  border-color: #4a7ac8;
  background: linear-gradient(to bottom, #5a8fd8, #3d6cb0);
  color: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-options-note,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-footnote {
  color: #333;
}

/* Диалог «Вставить как» — макет как у LibreOffice Calc */
.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog {
  position: fixed;
  inset: 0;
  z-index: 20001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(720px, 96vw);
  max-height: min(92vh, 560px);
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  background: #1e1e1e;
  color: #f0f0f0;
  font-family: Liberation Sans, Arial, sans-serif;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid #333;
  background: #252525;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__x {
  margin: 0;
  padding: 2px 10px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__x:hover {
  background: rgba(255, 255, 255, 0.1);
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__body {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  padding: 12px 14px;
  overflow: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #c8c8c8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid #444;
  border-radius: 3px;
  background: #2a2a2a;
  color: inherit;
  font: inherit;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__preset:hover {
  border-color: #6a9fd8;
  background: #333;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__preset--active {
  border-color: #6a9fd8;
  background: #354a62;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__immediate {
  margin-top: 10px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 80%;
  max-width: 80%;
  align-self: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__column {
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__check,
.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__radio {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 5px;
  cursor: pointer;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__check--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Чекбоксы диалога — белый квадрат, галочка чёрная (как в Calc) */
.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #808080;
  border-radius: 2px;
  background: #ffffff;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="checkbox"]:checked {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2 5 8.7 9.5 3.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="checkbox"]:focus-visible {
  outline: 1px solid #0078d7;
  outline-offset: 1px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Радиокнопки — белый круг, точка чёрная (без синего accent браузера) */
.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #808080;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="radio"]:checked {
  background-color: #ffffff;
  border-color: #505050;
  background-image: radial-gradient(circle, #000000 0 4px, transparent 4.5px);
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="radio"]:focus-visible {
  outline: 1px solid #505050;
  outline-offset: 1px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog input[type="radio"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__fieldset {
  margin: 12px 0 0;
  padding: 8px 10px 6px;
  border: 1px solid #444;
  border-radius: 3px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__fieldset .libreoffice-lo-paste-special-dialog__section-title {
  padding: 0 4px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #333;
  background: #252525;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__footer-right {
  display: flex;
  gap: 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__btn {
  min-width: 72px;
  padding: 5px 14px;
  border: 1px solid #555;
  border-radius: 3px;
  background: linear-gradient(to bottom, #3a3a3a, #2a2a2a);
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__btn:hover {
  background: linear-gradient(to bottom, #454545, #333);
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__btn--primary {
  border-color: #4a7ac8;
  background: linear-gradient(to bottom, #5a8fd8, #3d6cb0);
  color: #fff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__btn--primary:hover {
  background: linear-gradient(to bottom, #6a9fe8, #4d7cc0);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__window {
  background: #f0f0f0;
  color: #1a1a1a;
  border-color: #a0a0a0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__titlebar,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__footer {
  background: #e8e8e8;
  border-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__preset {
  background: #fff;
  border-color: #a8a8a8;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-paste-special-dialog__btn {
  border-color: #a0a0a0;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  color: #1a1a1a;
}

/* Диалог «Формат ячеек» — макет LibreOffice Calc (светлая палитра) */
.libreoffice-lo-format-cells-dialog {
  --hf-fc-bg: #f0f0f0;
  --hf-fc-surface: #ffffff;
  --hf-fc-nav: #e8e8e8;
  --hf-fc-nav-active: #d9e8f7;
  --hf-fc-nav-active-border: #8cb4e2;
  --hf-fc-border: #9b9b9b;
  --hf-fc-border-light: #c8c8c8;
  --hf-fc-text: #1a1a1a;
  --hf-fc-muted: #4a4a4a;
  --hf-fc-titlebar: #e8e8e8;
  --hf-fc-footer: #f0f0f0;
  --hf-fc-input-bg: #ffffff;
  --hf-fc-focus: #0078d7;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog {
  position: fixed;
  inset: 0;
  z-index: 20002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  font-family: "Liberation Sans", "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  color: var(--hf-fc-text);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(652px, 96vw);
  min-height: min(440px, 88vh);
  max-height: min(92vh, 520px);
  border: 1px solid var(--hf-fc-border);
  border-radius: 2px;
  background: var(--hf-fc-bg);
  color: var(--hf-fc-text);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--hf-fc-border-light);
  background: var(--hf-fc-titlebar);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__x {
  margin: 0;
  padding: 0 8px;
  min-width: 28px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--hf-fc-text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__x:hover {
  border-color: var(--hf-fc-border);
  background: rgba(0, 0, 0, 0.06);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__body {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav {
  flex: 0 0 200px;
  min-width: 180px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 4px;
  border-right: 1px solid var(--hf-fc-border-light);
  background: var(--hf-fc-nav);
  overflow-y: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--hf-fc-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-icon img {
  display: block;
  width: 20px;
  height: 20px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-label {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 0;
  line-height: 1.25;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
  border-color: var(--hf-fc-border-light);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-btn--active {
  border-color: var(--hf-fc-nav-active-border);
  background: var(--hf-fc-nav-active);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__main {
  flex: 1;
  min-width: 0;
  padding: 12px 14px 10px;
  overflow: auto;
  background: var(--hf-fc-surface);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-tab[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-tab--muted {
  color: var(--hf-fc-muted);
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-tab__hint {
  margin: 10px 0 0;
  line-height: 1.45;
  color: var(--hf-fc-muted);
  font-size: 11px;
}

/* Вкладка «Числа» */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-numbers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 14px 16px;
  align-items: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-numbers__lists,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-numbers__settings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__label {
  display: block;
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--hf-fc-text);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__label--sample {
  margin-top: 2px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__listbox,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__combo,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__select {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 6px;
  padding: 2px 4px;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: var(--hf-fc-input-bg);
  color: var(--hf-fc-text);
  font: inherit;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__listbox {
  padding: 2px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__listbox--category {
  height: 148px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__listbox--formats {
  height: 108px;
  margin-bottom: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__combo {
  height: 24px;
  margin-bottom: 8px;
  padding: 2px 6px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-preview {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  min-height: 52px;
  margin: 2px 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--hf-fc-border);
  background: var(--hf-fc-input-bg);
  color: #000;
  font-size: 14px;
  line-height: 1.2;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-group {
  margin: 0 0 10px;
  padding: 10px 10px 8px;
  border: 1px solid var(--hf-fc-border-light);
  border-radius: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-group legend,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-fieldset legend {
  padding: 0 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--hf-fc-text);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-options {
  margin-bottom: 10px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__check,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__radio,
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 12px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__row {
  justify-content: space-between;
  cursor: default;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__row span:first-child {
  flex: 1;
  padding-right: 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__check--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__spin {
  width: 52px;
  height: 22px;
  padding: 1px 4px;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: var(--hf-fc-input-bg);
  color: var(--hf-fc-text);
  font: inherit;
  font-size: 12px;
  text-align: right;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__code {
  width: 100%;
  height: 24px;
  margin-top: 2px;
  padding: 2px 6px;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: var(--hf-fc-input-bg);
  color: var(--hf-fc-text);
  font-family: "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

/* Чекбоксы и радио — как в Calc */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #808080;
  border-radius: 2px;
  background: #ffffff;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog input[type="checkbox"]:checked {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2.5 6.2 5 8.7 9.5 3.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  margin: 0;
  border: 1px solid #808080;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog input[type="radio"]:checked {
  background-image: radial-gradient(circle, #000 0 35%, transparent 36%);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog input:focus-visible {
  outline: 1px solid var(--hf-fc-focus);
  outline-offset: 1px;
}

/* Вкладка «Шрифт» */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-font {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  max-width: 360px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-font__preview-wrap {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-preview--font {
  min-height: 64px;
  justify-content: flex-start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-tab--checks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 280px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-tab--checks .libreoffice-lo-format-cells-preview--font {
  margin-top: 12px;
}

/* Вкладка «Выравнивание» */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-alignment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  align-items: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-alignment__extra {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  padding-top: 4px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-fieldset {
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--hf-fc-border-light);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-fieldset .libreoffice-lo-format-cells__radio {
  margin-bottom: 4px;
}

/* Вкладка «Обрамление» */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-layout__controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker {
  display: grid;
  grid-template-columns: 28px 48px 28px;
  grid-template-rows: 24px 48px 24px;
  gap: 2px;
  justify-items: center;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--hf-fc-border-light);
  background: var(--hf-fc-bg);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: linear-gradient(to bottom, #fafafa, #e8e8e8);
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge:hover {
  background: linear-gradient(to bottom, #fff, #f0f0f0);
  border-color: var(--hf-fc-focus);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge--selected {
  border-color: var(--hf-fc-focus);
  background: #d9e8f7;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge--top {
  grid-column: 2;
  grid-row: 1;
  width: 48px;
  height: 14px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge--bottom {
  grid-column: 2;
  grid-row: 3;
  width: 48px;
  height: 14px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge--left {
  grid-column: 1;
  grid-row: 2;
  width: 14px;
  height: 48px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__edge--right {
  grid-column: 3;
  grid-row: 2;
  width: 14px;
  height: 48px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-picker__sample {
  grid-column: 2;
  grid-row: 2;
  width: 48px;
  height: 48px;
  border: 1px solid #000;
  background: var(--hf-fc-surface);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-preset {
  min-width: 72px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  color: var(--hf-fc-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-preset:hover {
  background: linear-gradient(to bottom, #fff, #ececec);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-fill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__color {
  width: 40px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--hf-fc-border);
  border-radius: 0;
  background: var(--hf-fc-input-bg);
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells__link-btn {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: #0563c1;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

/* Подвал */
.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--hf-fc-border-light);
  background: var(--hf-fc-footer);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__footer-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-left: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__btn {
  min-width: 88px;
  margin: 0;
  padding: 5px 16px;
  border: 1px solid var(--hf-fc-border);
  border-radius: 2px;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
  color: var(--hf-fc-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__btn:hover {
  background: linear-gradient(to bottom, #fff, #ececec);
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__btn--primary {
  min-width: 88px;
  border-color: #0078d7;
  background: linear-gradient(to bottom, #5cadff, #328cdc);
  color: #fff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__btn--primary:hover {
  background: linear-gradient(to bottom, #6eb6ff, #3d93e8);
}

@media (max-width: 560px) {
  .libreoffice-sheet-calc-container .libreoffice-lo-format-cells-numbers,
  .libreoffice-sheet-calc-container .libreoffice-lo-format-cells-alignment,
  .libreoffice-sheet-calc-container .libreoffice-lo-format-cells-border-layout {
    grid-template-columns: 1fr;
  }

  .libreoffice-sheet-calc-container .libreoffice-lo-format-cells-dialog__nav {
    flex: 0 0 120px;
  }
}

/*
 * Handsontable: окно фильтра столбца (dropdown + подменю условий) под референс —
 * подписи и флажки слева, белый фон квадрата чекбокса, у «Фильтр по условию»
 * стрелка вправо (как подменю). Меню монтируется в #hyperformula-root (dropdownMenu.uiContainer).
 * Вложенный HOT чеклиста — .htUIMultipleSelectHot.handsontable; см. hf_ht_filter_menu_overrides.css.
 */
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot.handsontable,
#hyperformula-root .htMenu .htUIMultipleSelectHot.handsontable,
#hyperformula-root .handsontable.htDropdownMenu .htUIMultipleSelectHot.handsontable {
  --ht-checkbox-background-color: #ffffff !important;
  --ht-checkbox-border-color: #808080 !important;
  --ht-checkbox-checked-background-color: #ffffff !important;
  --ht-checkbox-checked-border-color: #505050 !important;
  --ht-checkbox-checked-icon-color: #000000 !important;
  --ht-checkbox-checked-focus-background-color: #ffffff !important;
  --ht-checkbox-checked-focus-border-color: #505050 !important;
  --ht-checkbox-checked-focus-icon-color: #000000 !important;
  --ht-checkbox-icon-color: rgba(0, 0, 0, 0) !important;
}

#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput,
#hyperformula-root .htMenu.handsontable.htDropdownMenu .htUIMultipleSelectHot input.htCheckboxRendererInput,
#hyperformula-root .handsontable.htDropdownMenu .htUIMultipleSelectHot input.htCheckboxRendererInput,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput {
  --ht-checkbox-background-color: #ffffff !important;
  --ht-checkbox-border-color: #808080 !important;
  --ht-checkbox-checked-background-color: #ffffff !important;
  --ht-checkbox-checked-border-color: #505050 !important;
  --ht-checkbox-checked-icon-color: #000000 !important;
  --ht-checkbox-checked-focus-background-color: #ffffff !important;
  --ht-checkbox-checked-focus-border-color: #505050 !important;
  --ht-checkbox-checked-focus-icon-color: #000000 !important;
}

html:not([data-theme="dark"]) #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input {
  background-color: #ffffff !important;
  border-color: #767676 !important;
  color: #000000 !important;
}

html:not([data-theme="dark"]) #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:hover {
  background-color: #f0f0f0 !important;
  border-color: #505050 !important;
  color: #000000 !important;
}

html:not([data-theme="dark"]) #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:focus,
html:not([data-theme="dark"]) #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:focus-visible {
  background-color: #ffffff !important;
  border-color: #0078d7 !important;
  color: #000000 !important;
  box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.25) !important;
}

html:not([data-theme="dark"]) #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:disabled {
  background-color: #e8e8e8 !important;
  border-color: #a0a0a0 !important;
  color: #707070 !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input {
  background-color: #333333 !important;
  border-color: #666666 !important;
  color: #ffffff !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:hover {
  background-color: #404040 !important;
  border-color: #888888 !important;
  color: #ffffff !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:focus,
[data-theme="dark"] #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:focus-visible {
  background-color: #3a3a3a !important;
  border-color: #6bb9ff !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(107, 185, 255, 0.35) !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htItemWrapper .htUIInput.htUIButton input:disabled {
  background-color: #252525 !important;
  border-color: #555555 !important;
  color: #888888 !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable.htDropdownMenu .htCheckboxRendererLabel,
[data-theme="dark"] #hyperformula-root .handsontable.htDropdownMenu .htCheckboxRendererLabel,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable .htUIMultipleSelectHot .htCheckboxRendererLabel,
[data-theme="dark"] #hyperformula-root .handsontable .htUIMultipleSelectHot .htCheckboxRendererLabel {
  color: #f5f5f5 !important;
}

/* Тёмная тема: перебить vendor `.htDropdownMenu table tbody tr td{background:#fff}` (инлайн task3 идёт позже; дубль для порядка загрузки). */
html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) table.htCore tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) table tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htDropdownMenu:not(.htGhostTable) table.htCore tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htDropdownMenu:not(.htGhostTable) table tbody tr td {
  background-color: #2d2d2d !important;
  color: #f0f0f0 !important;
  border-color: #555555 !important;
}

html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu .htUIMultipleSelectHot:not(.htGhostTable) table.htCore tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu .htUIMultipleSelectHot:not(.htGhostTable) table tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htDropdownMenu .htUIMultipleSelectHot:not(.htGhostTable) table.htCore tbody tr td,
html[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htDropdownMenu .htUIMultipleSelectHot:not(.htGhostTable) table tbody tr td {
  background-color: #252525 !important;
  color: #f0f0f0 !important;
  border-color: #444444 !important;
}

html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) .wtHolder,
html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) .wtHider,
html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) .wtSpreader {
  background-color: #2d2d2d !important;
}

html[data-theme="dark"] body.neuroege-hyperformula-page .htDropdownMenu:not(.htGhostTable) table tbody tr td.htDisabled:hover {
  background-color: #2d2d2d !important;
  color: #888888 !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htFiltersMenuCondition .htUISelectCaption,
[data-theme="dark"] #hyperformula-root .handsontable .htFiltersMenuOperators .htUISelectCaption,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable .htFiltersMenuCondition .htUISelectCaption,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable .htFiltersMenuOperators .htUISelectCaption {
  background-color: #1e1e1e !important;
  color: #f0f0f0 !important;
  border-color: #666666 !important;
}

[data-theme="dark"] #hyperformula-root .handsontable .htFiltersMenuLabel,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable .htFiltersMenuLabel {
  color: #f5f5f5 !important;
}

/* Тёмная тема: каркас .htMenu.handsontable.htDropdownMenu (в т.ч. uiContainer = body). */
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htDropdownMenu > .ht_master,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu > .ht_master,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu > .ht_master,
[data-theme="dark"] #hyperformula-root .handsontable.htDropdownMenu > .ht_master,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu > .ht_master,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu > .ht_master {
  background-color: #2d2d2d !important;
  box-shadow: 2px 2px 18px rgba(0, 0, 0, 0.55) !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htDropdownMenu table tbody tr td.htSeparator,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu table tbody tr td.htSeparator,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu table tbody tr td.htSeparator,
[data-theme="dark"] #hyperformula-root .handsontable.htDropdownMenu table tbody tr td.htSeparator,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu table tbody tr td.htSeparator,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu table tbody tr td.htSeparator {
  border-top-color: #444 !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td {
  background-color: #2d2d2d !important;
  color: #f0f0f0 !important;
  border-color: #444 !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td {
  background-color: #3a4a60 !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] body.neuroege-hyperformula-page .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr > td.htDimmed,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr > td.htDimmed {
  color: #888 !important;
}

/* HyperFormula: контекстное меню ячеек (Calc / Colibre). */
body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore,
#hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore {
  min-width: 340px !important;
  width: max-content !important;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) table tbody tr td,
#hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) table tbody tr td {
  padding: 0 !important;
  vertical-align: middle;
}

/* HT по умолчанию: overflow:hidden + ellipsis на td — обрезает shortcuts справа. */
body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) table tbody tr td.htCustomMenuRenderer,
#hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) table tbody tr td.htCustomMenuRenderer {
  overflow: hidden !important;
  text-overflow: clip !important;
  white-space: normal !important;
  min-width: 340px !important;
}

/* HT ::after только у .htSubmenu; у остальных пунктов скрыть (иначе «просачивается» вниз). */
.handsontable.htContextMenu td.htCustomMenuRenderer:not(.htSubmenu) .htItemWrapper::after,
[class*="ht-theme"].htContextMenu td.htCustomMenuRenderer:not(.htSubmenu) .htItemWrapper::after,
[class*="ht-theme-main"].htContextMenu table tbody tr td.htCustomMenuRenderer:not(.htSubmenu) .htItemWrapper::after,
body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htSubmenu) .htItemWrapper::after,
#hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htSubmenu) .htItemWrapper::after {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
  mask: none !important;
  -webkit-mask-image: none !important;
  background: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer .htItemWrapper,
#hyperformula-root .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer .htItemWrapper {
  position: relative;
  overflow: hidden;
}

/* HT .htSubmenu :after не двигается через right — ▶ в 3-й колонке сетки, как шорткаты. */
body.neuroege-hyperformula-page .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer::after,
#hyperformula-root .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer::after,
body.neuroege-hyperformula-page .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer ::after,
#hyperformula-root .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer ::after,
body.neuroege-hyperformula-page .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer ::before,
#hyperformula-root .handsontable.htContextMenu td.htSubmenu.htCustomMenuRenderer ::before,
.handsontable .htContextMenu td.htSubmenu.htCustomMenuRenderer ::after {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item__submenu-arrow,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item__submenu-arrow {
  margin-left: 20px;
  padding-right: 2px;
  opacity: 0.72;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  justify-self: end;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer .htItemWrapper,
#hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer .htItemWrapper {
  width: 100%;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 5px 22px 5px 12px;
  box-sizing: border-box;
  font: 13px/1.25 Liberation Sans, Arial, sans-serif;
  color: inherit;
  background: transparent;
}

/* HT исключает .htCustomMenuRenderer из своего :hover — подсветка на .hf-ctx-menu-item. */
html[data-theme="light"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html[data-theme="light"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item,
html[data-theme="light"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html[data-theme="light"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

/* Тёмная тема: подсветка чуть светлее базового tr:hover (#3a4a60). */
html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table.htCore > tbody > tr:hover > td,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) > .ht_master > .wtHolder > table > tbody > tr:hover > td {
  background-color: #4d607a !important;
}

html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled):hover,
html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled).current,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled):hover,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled).current,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled):hover,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled).current,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled):hover,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu:not(.htGhostTable) td.htCustomMenuRenderer:not(.htDisabled).current {
  background-color: #4d607a !important;
}

html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
[data-theme="dark"] body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
[data-theme="dark"] #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item {
  background-color: #4d607a !important;
}

/* Без data-theme (fallback): чуть светлее фона меню. */
html:not([data-theme="light"]) body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html:not([data-theme="light"]) body.neuroege-hyperformula-page .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item,
html:not([data-theme="light"]) #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled):hover .hf-ctx-menu-item,
html:not([data-theme="light"]) #hyperformula-root .handsontable.htContextMenu td.htCustomMenuRenderer:not(.htDisabled).current .hf-ctx-menu-item {
  background-color: #4d607a !important;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item__icon,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item__icon {
  width: 16px;
  height: 16px;
  justify-self: center;
  object-fit: contain;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item__icon-slot,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item__icon-slot {
  width: 16px;
  height: 16px;
  justify-self: center;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item__label,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item__label {
  min-width: 0;
  text-align: left;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu .hf-ctx-menu-item__shortcut,
#hyperformula-root .handsontable.htContextMenu .hf-ctx-menu-item__shortcut {
  margin-left: 20px;
  padding-right: 2px;
  opacity: 0.72;
  font-size: 12px;
  white-space: nowrap;
  justify-self: end;
}

body.neuroege-hyperformula-page .handsontable.htContextMenu td.htSubmenu .hf-ctx-menu-item,
#hyperformula-root .handsontable.htContextMenu td.htSubmenu .hf-ctx-menu-item {
  padding-right: 22px;
}

#hyperformula-root .handsontable.htDropdownMenu table tbody tr td,
#hyperformula-root .handsontable.htFiltersConditionsMenu table tbody tr td {
  text-align: left;
}

#hyperformula-root .handsontable .htFiltersMenuLabel {
  display: block;
  text-align: left;
}

#hyperformula-root .handsontable .htFiltersMenuCondition .htUIInput,
#hyperformula-root .handsontable .htFiltersMenuValue .htUIInput {
  text-align: left;
}

#hyperformula-root .handsontable .htFiltersMenuValue .htUIMultipleSelectSearch input {
  text-align: left;
}

#hyperformula-root .handsontable .htUISelectionControls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: calc(var(--ht-gap-size, 4px) * 2);
}

#hyperformula-root .handsontable .htUIMultipleSelectHot .wtHolder td {
  text-align: left;
}

#hyperformula-root .handsontable .htUIMultipleSelectHot .htCheckboxRendererLabel {
  text-align: left;
}

/* Белый фон квадрата флажка — явный background на ::before (перебивает var с темы) */
#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput::before,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput::before,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput::before,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput::before,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput::before,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput::before {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  border-color: #808080 !important;
}

#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::before,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::before,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::before,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked::before,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked::before,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked::before {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  border-color: #505050 !important;
}

#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked::after,
#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked:focus::after,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked::after,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked::after,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked:focus::after,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked:focus::after {
  color: #000 !important;
  background-color: #000 !important;
}

[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] body.neuroege-hyperformula-page #hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked::after,
[data-theme="dark"] #hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked:focus::after,
[data-theme="dark"] #hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked:focus::after {
  color: #27272a !important;
  background-color: #27272a !important;
}

#hyperformula-root .htMenu.handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::before,
#hyperformula-root .handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::before,
#hyperformula-root [class*="ht-theme-main"].handsontable.htDropdownMenu input.htCheckboxRendererInput:checked:focus::before,
#hyperformula-root .handsontable.htFiltersConditionsMenu input.htCheckboxRendererInput:checked:focus::before,
#hyperformula-root .htFiltersMenuValue .htUIMultipleSelectHot input.htCheckboxRendererInput:checked:focus::before,
#hyperformula-root .htUIMultipleSelectHot.handsontable input.htCheckboxRendererInput:checked:focus::before {
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  border-color: #505050 !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Выпадающее поле условия: одна стрелка справа (вправо), без дублирующего узла */
#hyperformula-root .handsontable .htFiltersMenuCondition .htUISelectDropdown,
#hyperformula-root .handsontable .htFiltersMenuOperators .htUISelectDropdown {
  display: none !important;
}

#hyperformula-root .handsontable .htFiltersMenuCondition .htUISelectCaption,
#hyperformula-root .handsontable .htFiltersMenuOperators .htUISelectCaption {
  text-align: left;
}

#hyperformula-root .handsontable .htFiltersMenuCondition .htUISelectCaption::after,
#hyperformula-root .handsontable .htFiltersMenuOperators .htUISelectCaption::after {
  transform: translateY(-50%) rotate(-90deg);
}

#hyperformula-root [dir=rtl].handsontable .htFiltersMenuCondition .htUISelectCaption::after,
#hyperformula-root [dir=rtl].handsontable .htFiltersMenuOperators .htUISelectCaption::after {
  right: auto;
  left: calc(var(--ht-input-horizontal-padding) - var(--ht-icon-size) / 4);
  transform: translateY(-50%) rotate(90deg);
}

/* Диалог «заголовки столбцов» /hyperformula/ — макет как LibreOffice Calc (вопрос + Да/Нет справа) */
.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal {
  position: fixed;
  inset: 0;
  z-index: 20001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(420px, 94vw);
  max-width: 420px;
  border: 1px solid #3a3a3a;
  border-radius: 2px;
  background: #2c2c2c;
  color: #f0f0f0;
  font-family: "Segoe UI", Liberation Sans, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 7px 12px;
  border-bottom: 1px solid #404040;
  background: #383838;
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f5;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__close {
  margin: 0;
  padding: 2px 10px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #ccc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 16px 16px 14px;
  background: #2c2c2c;
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__icon {
  flex-shrink: 0;
  color: #3b8ad6;
  line-height: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__icon-svg {
  display: block;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__textblock {
  flex: 1;
  min-width: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__line {
  margin: 0 0 6px;
  color: #ececec;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__line:last-child {
  margin-bottom: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__footer {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #404040;
  background: #333;
  flex-shrink: 0;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn {
  min-width: 76px;
  margin: 0;
  padding: 5px 16px;
  border: 1px solid #6a6a6a;
  border-radius: 2px;
  background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
  color: #f5f5f5;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn:hover {
  background: linear-gradient(to bottom, #555, #444);
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn--default {
  border-color: #5a8fc4;
  background: linear-gradient(to bottom, #3d6a9a, #2d5080);
  color: #fff;
  font-weight: 600;
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn--default:hover {
  background: linear-gradient(to bottom, #4578a8, #345e8e);
}

.libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn:focus-visible {
  outline: 2px solid #8ab4ff;
  outline-offset: 1px;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__window {
  border-color: #a0a0a0;
  background: #f0f0f0;
  color: #1a1a1a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__titlebar {
  background: #ebebeb;
  border-bottom-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__title {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__close {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #000;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__body {
  background: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__line {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__icon {
  color: #0078d7;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__footer {
  background: #ebebeb;
  border-top-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn {
  border-color: #7a7a7a;
  background: linear-gradient(to bottom, #fff, #e4e4e4);
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn:hover {
  background: linear-gradient(to bottom, #f8f8f8, #dcdcdc);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn--default {
  border-color: #2d6bb4;
  background: linear-gradient(to bottom, #4a8ad4, #2d6bb4);
  color: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .hyperformula-autofilter-header-modal__btn--default:hover {
  background: linear-gradient(to bottom, #5592d8, #3570b8);
}

/* Диалог «Высота строки» — макет как LibreOffice Calc */
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog {
  position: fixed;
  inset: 0;
  z-index: 200020;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(300px, 92vw);
  border: 1px solid #3a3a3a;
  border-radius: 2px;
  background: #2c2c2c;
  color: #f0f0f0;
  font-family: "Segoe UI", Liberation Sans, Arial, sans-serif;
  font-size: 13px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 10px;
  border-bottom: 1px solid #404040;
  background: #383838;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__x {
  margin: 0;
  padding: 0 8px;
  border: none;
  background: transparent;
  color: #ccc;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__x:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__body {
  padding: 14px 16px 12px;
  background: #2c2c2c;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__height-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__height-label {
  flex: 0 0 auto;
  min-width: 52px;
  font-size: 13px;
  color: inherit;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spinbox {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 26px;
  border: 1px solid #6a6a6a;
  border-radius: 2px;
  background: #1a1a1a;
  overflow: hidden;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 3px 6px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-unit {
  flex: 0 0 auto;
  align-self: center;
  padding-right: 2px;
  font-size: 13px;
  color: #d0d0d0;
  user-select: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-arrows {
  flex: 0 0 18px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #6a6a6a;
  background: #333;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn {
  flex: 1;
  margin: 0;
  padding: 0;
  min-width: 18px;
  min-height: 12px;
  border: none;
  border-bottom: 1px solid #555;
  background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
  cursor: pointer;
  position: relative;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn:last-child {
  border-bottom: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #555, #444);
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="up"]::after,
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="down"]::after,
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="up"]::after,
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="down"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  pointer-events: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="up"]::after,
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="up"]::after {
  border-bottom: 5px solid #e8e8e8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="down"]::after,
.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="down"]::after {
  border-top: 5px solid #e8e8e8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__default-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-left: 62px;
  font-size: 13px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__default-check input {
  margin: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #404040;
  background: #333;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn {
  min-width: 76px;
  margin: 0;
  padding: 5px 14px;
  border: 1px solid #6a6a6a;
  border-radius: 2px;
  background: linear-gradient(to bottom, #4a4a4a, #3a3a3a);
  color: #f5f5f5;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn:hover {
  background: linear-gradient(to bottom, #555, #444);
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer .libreoffice-lo-row-height-dialog__btn:first-child {
  justify-self: start;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer .libreoffice-lo-row-height-dialog__btn--default {
  justify-self: center;
  border-color: #5a8fc4;
  background: linear-gradient(to bottom, #3d6a9a, #2d5080);
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer .libreoffice-lo-row-height-dialog__btn--default:hover {
  background: linear-gradient(to bottom, #4578a8, #345e8e);
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer .libreoffice-lo-row-height-dialog__btn:last-child {
  justify-self: end;
}

.libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn:focus-visible {
  outline: 2px solid #8ab4ff;
  outline-offset: 1px;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__window {
  border-color: #a0a0a0;
  background: #f0f0f0;
  color: #1a1a1a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__titlebar {
  background: #ebebeb;
  border-bottom-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__x {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__x:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #000;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__body {
  background: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spinbox {
  border-color: #7a7a7a;
  background: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-input {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-unit {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-arrows {
  border-left-color: #7a7a7a;
  background: #f5f5f5;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn {
  border-bottom-color: #b0b0b0;
  background: linear-gradient(to bottom, #fafafa, #e4e4e4);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #fff, #ececec);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="up"]::after,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="up"]::after {
  border-bottom-color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-height-step="down"]::after,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__spin-btn[data-hf-row-optimal-height-step="down"]::after {
  border-top-color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__footer {
  background: #ebebeb;
  border-top-color: #c0c0c0;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn {
  border-color: #7a7a7a;
  background: linear-gradient(to bottom, #fff, #e4e4e4);
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn:hover {
  background: linear-gradient(to bottom, #f8f8f8, #dcdcdc);
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn--default {
  border-color: #2d6bb4;
  background: linear-gradient(to bottom, #4a8ad4, #2d6bb4);
  color: #fff;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-row-height-dialog__btn--default:hover {
  background: linear-gradient(to bottom, #5592d8, #3570b8);
}

/* Вкладка «Параметры» — как LibreOffice Calc (param_Sort.png) */
.libreoffice-sheet-calc-container .libreoffice-lo-sort-panel--options {
  padding-right: 4px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-heading {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #f2f2f2;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-line input[type="checkbox"],
.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-line input[type="radio"] {
  flex-shrink: 0;
  margin: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-line--radio {
  cursor: pointer;
  color: #d8d8d8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-group {
  margin-bottom: 4px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-indent {
  margin: 4px 0 12px 22px;
  padding-left: 6px;
  border-left: 2px solid #3d3d3d;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-indent[aria-disabled="true"],
.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-indent.libreoffice-lo-sort-opt-indent--muted {
  opacity: 0.45;
  pointer-events: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-dest-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  pointer-events: none;
  opacity: 0.45;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-dest-controls.libreoffice-lo-sort-opt-dest-controls--active {
  pointer-events: auto;
  opacity: 1;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-select--opt-dest {
  min-width: 160px;
  max-width: 220px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-select--opt-wide,
.libreoffice-sheet-calc-container .libreoffice-lo-sort-select--opt-full {
  width: 100%;
  max-width: 100%;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-text {
  flex: 1;
  min-width: 120px;
  height: 26px;
  padding: 2px 8px;
  border: 1px solid #555;
  border-radius: 2px;
  background: #2d2d2d;
  color: #f0f0f0;
  font: inherit;
  font-size: 12px;
  box-sizing: border-box;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-locale-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #3a3a3a;
}

@media (max-width: 520px) {
  .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-locale-grid {
    grid-template-columns: 1fr;
  }
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-locale-cap {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #bbb;
}

.libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-footnote {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #9a9a9a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-heading {
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-line--radio {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-indent {
  border-left-color: #ccc;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-text {
  border-color: #a8a8a8;
  background: #fff;
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-locale-grid {
  border-top-color: #ccc;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-sort-opt-locale-cap {
  color: #555;
}

/* Диалог «Текст по столбцам» — общий каркас как у «Вставить как» */
.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog .libreoffice-lo-paste-special-dialog__window {
  width: min(680px, 96vw);
  max-height: min(92vh, 640px);
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  grid-template-columns: unset;
  overflow: auto;
  max-height: calc(92vh - 140px);
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__modes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-bottom: 10px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__modes .libreoffice-lo-paste-special-dialog__radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__delim-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px 18px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #3a3a3a;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__delim-grid .libreoffice-lo-paste-special-dialog__check {
  flex: 0 0 auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__sep-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__misc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-bottom: 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__misc-row:last-child {
  margin-bottom: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__string-delim-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__string-delim-label {
  font-size: 12px;
  color: #c8c8c8;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__select--inline {
  min-width: 72px;
  width: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__delim-grid--disabled {
  opacity: 0.45;
  pointer-events: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__other-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__other-input {
  width: 52px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #555;
  border-radius: 2px;
  background: #2d2d2d;
  color: inherit;
  font: inherit;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__inline-label {
  min-width: 140px;
  font-size: 12px;
  color: #c8c8c8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__select {
  min-width: 120px;
  height: 26px;
  padding: 2px 8px;
  border: 1px solid #555;
  border-radius: 2px;
  background: #2d2d2d;
  color: #f0f0f0;
  font: inherit;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__fields {
  margin-top: 4px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__preview-hint {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.35;
  color: #a8a8a8;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__preview-hint {
  color: #555;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-wrap {
  margin-top: 8px;
  border: 1px solid #444;
  border-radius: 2px;
  overflow: auto;
  min-height: 160px;
  max-height: min(420px, 50vh);
  background: #111;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th,
.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table td {
  border: 1px solid #444;
  padding: 4px 10px;
  min-width: 56px;
  text-align: left;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th {
  background: #252525;
  font-weight: 600;
  color: #c8c8c8;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th.libreoffice-lo-ttc-preview-table__num,
.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table td.libreoffice-lo-ttc-preview-table__num {
  box-sizing: border-box;
  min-width: 32px;
  width: 2.75em;
  max-width: 56px;
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #909090;
  user-select: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th.libreoffice-lo-ttc-preview-table__num {
  color: #707070;
}

.libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table tbody th.libreoffice-lo-ttc-preview-table__num {
  background: #111;
  font-weight: 400;
  color: #909090;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__delim-grid {
  border-color: #ccc;
  background: #f5f5f5;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__other-input,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__select {
  border-color: #a8a8a8;
  background: #fff;
  color: #1a1a1a;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-text-to-columns-dialog__string-delim-label {
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-wrap {
  border-color: #ccc;
  background: #fafafa;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table td {
  border-color: #ccc;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th {
  background: #eaeaea;
  color: #333;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th.libreoffice-lo-ttc-preview-table__num,
html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table td.libreoffice-lo-ttc-preview-table__num {
  color: #666;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table th.libreoffice-lo-ttc-preview-table__num {
  color: #888;
}

html[data-theme="light"] .libreoffice-sheet-calc-container .libreoffice-lo-ttc-preview-table tbody th.libreoffice-lo-ttc-preview-table__num {
  background: #fafafa;
  color: #666;
}

/* Плавающая панель «Найти / Найти и заменить» — макет LibreOffice Calc */
.libreoffice-sheet-calc-container {
  position: relative;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 200030;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
  background: transparent;
  padding: 0;
  overflow: visible;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__panel {
  pointer-events: auto;
  width: min(580px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(90vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #ececec;
  border: 1px solid #6a6a6a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-family: Liberation Sans, Arial, sans-serif;
  font-size: 13px;
  color: #222;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: linear-gradient(180deg, #fff 0%, #e4e4e4 100%);
  border-bottom: 1px solid #a8a8a8;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__header--dragging {
  cursor: grabbing;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__header-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: #333;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__header-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__body {
  padding: 10px 12px 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__field {
  display: grid;
  grid-template-columns: 68px 1fr;
  column-gap: 8px;
  row-gap: 4px;
  align-items: center;
  margin-bottom: 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__label {
  justify-self: end;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__combo {
  position: relative;
  display: flex;
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__combo::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 17px;
  pointer-events: none;
  border-left: 1px solid #a8a8a8;
  background: linear-gradient(180deg, #fafafa 0%, #dcdcdc 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23333' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: center, calc(50% + 0px) calc(50% + 1px);
  background-size: auto, 8px 5px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__input {
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  padding: 2px 22px 2px 6px;
  border: 1px solid #a8a8a8;
  background: #fff;
  font: inherit;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__field-options {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__check {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__check--stub,
.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__check:has(input:disabled) {
  opacity: 0.55;
  cursor: default;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
  padding-left: 76px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0 0 6px;
  padding: 2px 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-icon {
  display: inline-block;
  width: 18px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-panel[hidden] {
  display: none !important;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-panel {
  margin: 0 0 6px 20px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 28px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__more-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__mini-btn {
  align-self: flex-start;
  margin: 0 0 2px 22px;
  padding: 2px 8px;
  font: inherit;
  font-size: 13px;
  border: 1px solid #a8a8a8;
  border-radius: 2px;
  background: linear-gradient(180deg, #fafafa 0%, #e0e0e0 100%);
  cursor: not-allowed;
  opacity: 0.55;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin: 8px 0 4px;
  padding-left: 76px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__direction {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  border: none;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__scope-label {
  font-size: 13px;
  white-space: nowrap;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__direction .libreoffice-lo-find-dialog__scope-label {
  margin: 0;
  padding: 0;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__search-in {
  display: flex;
  align-items: center;
  gap: 8px;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__select {
  min-width: 140px;
  min-height: 24px;
  padding: 2px 24px 2px 6px;
  border: 1px solid #a8a8a8;
  border-radius: 0;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: inherit;
  appearance: auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__status {
  margin: 4px 0 0;
  min-height: 1.2em;
  font-size: 12px;
  color: #444;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__status--error {
  color: #a40000;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid #b8b8b8;
  background: #ececec;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__btn {
  min-width: 88px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  border: 1px solid #a8a8a8;
  border-radius: 2px;
  background: linear-gradient(180deg, #fafafa 0%, #e0e0e0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__actions .libreoffice-lo-find-dialog__btn {
  min-width: 0;
  flex: 0 1 auto;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__btn--default {
  border-color: #6a6a6a;
  box-shadow: inset 0 0 0 1px #f5f5f5, inset 0 -1px 0 #c8c8c8;
  font-weight: 600;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__btn:active:not(:disabled) {
  background: linear-gradient(180deg, #e0e0e0 0%, #f0f0f0 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog--find-only [data-hf-find-replace-block],
.libreoffice-sheet-calc-container .libreoffice-lo-find-dialog--find-only [data-hf-find-replace] {
  display: none !important;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__panel {
  background: #2c2c2c;
  border-color: #555;
  color: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__header {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-bottom-color: #555;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__input {
  background: #1e1e1e;
  border-color: #555;
  color: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__footer {
  background: #2c2c2c;
  border-top-color: #555;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__select {
  background: #1e1e1e;
  border-color: #555;
  color: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-sheet-calc-container .libreoffice-lo-find-dialog__combo::after {
  border-left-color: #555;
  background-color: #3a3a3a;
}
