/* LibreOffice Writer — тренажёр задания 10 */

.libreoffice-writer-container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  background: #ebebeb;
  border: 1px solid #b8b8b8;
  box-sizing: border-box;
}

.libreoffice-writer-container .univer-libre-title-bar__text::before {
  content: "";
}

.libreoffice-writer-toolbar {
  flex-shrink: 0;
  min-height: 36px;
  padding: 2px 4px;
  background: linear-gradient(180deg, #f8f8f8 0%, #e8e8e8 100%);
  border-bottom: 1px solid #c0c0c0;
}

.libreoffice-writer-toolbar .libreoffice-lo-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.libreoffice-writer-toolbar-sep {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: #c0c0c0;
  flex-shrink: 0;
}

.libreoffice-writer-container .libreoffice-lo-toolbar__btn img,
.libreoffice-writer-container .univer-libre-toolbar-btn img {
  width: 24px;
  height: 24px;
  max-height: 24px;
  display: block;
  object-fit: contain;
}

.libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn,
.libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn {
  min-width: 26px;
  min-height: 26px;
  border-radius: 2px;
  transition: background-color 0.12s ease;
}

/* Светлая тема: светлая панель, тёмные иконки (light Colibre), лёгкий hover */
html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn,
html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn {
  background-color: transparent;
}

html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:hover,
html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:hover,
html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:focus-visible,
html[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:focus-visible,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:hover,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:hover,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:focus-visible,
[data-theme="light"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:focus-visible {
  background-color: rgba(0, 0, 0, 0.08);
  outline: none;
}

.libreoffice-writer-font-select,
.libreoffice-writer-size-select {
  height: 24px;
  font-size: 12px;
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  background: #fff;
  max-width: 140px;
}

.libreoffice-writer-ruler {
  flex-shrink: 0;
  height: 18px;
  background: #f0f0f0
    repeating-linear-gradient(90deg, #ccc 0, #ccc 1px, transparent 1px, transparent 12px);
  border-bottom: 1px solid #c8c8c8;
}

.libreoffice-writer-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

/* Область просмотра: не прокручивается; панель «Найти» привязана к ней */
.libreoffice-writer-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.libreoffice-writer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  background: #6e6e6e;
  padding: 16px 24px;
}

.libreoffice-writer-navigator {
  flex: 0 0 min(260px, 38%);
  width: min(260px, 38%);
  max-width: 320px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f0f0f0;
  border-left: 1px solid #b8b8b8;
  box-sizing: border-box;
}

.libreoffice-writer-navigator[hidden] {
  display: none !important;
}

.libreoffice-writer-navigator__head {
  flex-shrink: 0;
  padding: 4px 6px;
  font-size: 11px;
  font-family: Liberation Sans, Arial, sans-serif;
  color: #333;
  background: linear-gradient(180deg, #fafafa 0%, #e8e8e8 100%);
  border-bottom: 1px solid #c0c0c0;
}

.libreoffice-writer-navigator__head-label {
  font-weight: 600;
}

.libreoffice-writer-navigator__tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 4px 0 8px;
  font-size: 12px;
  font-family: Liberation Sans, Arial, sans-serif;
  -webkit-overflow-scrolling: touch;
}

.libreoffice-writer-navigator__empty {
  margin: 8px 10px;
  color: #666;
  font-style: italic;
}

.libreoffice-writer-navigator__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.libreoffice-writer-navigator__list .libreoffice-writer-navigator__list {
  position: relative;
  margin: 0;
  padding: 0;
}

/* Пунктирные линии дерева (как в LibreOffice Navigator) */
.libreoffice-writer-navigator__item--open > .libreoffice-writer-navigator__list::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -7px;
  height: 7px;
  border-left: 1px dotted #9a9a9a;
  pointer-events: none;
}

.libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item {
  position: relative;
  padding-left: 16px;
}

.libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  border-left: 1px dotted #9a9a9a;
  pointer-events: none;
}

.libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item:last-child::before {
  bottom: 50%;
}

.libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 11px;
  margin-top: -0.5px;
  border-top: 1px dotted #9a9a9a;
  pointer-events: none;
}

.libreoffice-writer-navigator__item {
  margin: 0;
  padding: 0;
}

.libreoffice-writer-navigator__item--collapsed > .libreoffice-writer-navigator__list {
  display: none;
}

.libreoffice-writer-navigator__row {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  min-height: 14px;
  padding: 0 4px 0 1px;
  border: none;
  background: transparent;
  color: #222;
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

.libreoffice-writer-navigator__row:hover {
  background: rgba(0, 0, 0, 0.06);
}

.libreoffice-writer-navigator__row--active,
.libreoffice-writer-navigator__row--active:hover {
  background: #3d7ec9;
  color: #fff;
}

.libreoffice-writer-navigator__twisty {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #222;
  opacity: 1;
  box-sizing: border-box;
}

.libreoffice-writer-navigator__twisty:not(.libreoffice-writer-navigator__twisty--leaf) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #808080;
  background: #fff;
  cursor: pointer;
}

.libreoffice-writer-navigator__twisty--leaf {
  visibility: visible;
  border: none;
  background: transparent;
}

.libreoffice-writer-navigator__row--active .libreoffice-writer-navigator__twisty:not(.libreoffice-writer-navigator__twisty--leaf) {
  border-color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.libreoffice-writer-navigator__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Контекстное меню заголовка в навигаторе */
body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu.calc-menu-dropdown {
  position: fixed;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 16px));
  z-index: 100001;
  padding: 0;
  font-size: 12px;
  line-height: 1.15;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .calc-menu-item {
  padding: 2px 10px 2px 6px;
  line-height: 1.15;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .calc-menu-check {
  font-size: 11px;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .calc-menu-shortcut {
  font-size: 10px;
  margin-left: 14px;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .calc-menu-sep {
  margin: 1px 0;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu {
  padding: 0;
  font-size: 12px;
  line-height: 1.15;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu-host {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu-parent {
  width: 100%;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-arrow {
  margin-left: 10px;
  font-size: 9px;
  opacity: 0.65;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 2px;
  min-width: 12rem;
  max-height: min(18rem, calc(100vh - 24px));
  overflow-y: auto;
  z-index: 100002;
}

body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu[hidden] {
  display: none !important;
}

html[data-theme="dark"] body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu.calc-menu-dropdown,
[data-theme="dark"] body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu.calc-menu-dropdown {
  border-color: #555;
  background: #2d2d2d;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu,
[data-theme="dark"] body.neuroege-writer-page > .libreoffice-writer-nav-ctx-menu .libreoffice-writer-nav-ctx-submenu {
  border-color: #555;
  background: #2d2d2d;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.45);
}

.libreoffice-writer-page {
  max-width: 21cm;
  margin: 0 auto;
  min-height: 29.7cm;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 2cm 2.5cm 2.5cm;
  box-sizing: border-box;
  /* zoom задаётся из JS (Ctrl+колесо); точка масштабирования — верх по центру листа */
  transform-origin: top center;
}

.libreoffice-writer-document {
  outline: none;
  font-family: "Times New Roman", "Liberation Serif", Times, serif;
  font-size: 12pt;
  line-height: 1.35;
  color: #000;
  min-height: 24cm;
}

.libreoffice-writer-document .libreoffice-writer-p,
.libreoffice-writer-document .libreoffice-writer-h {
  margin: 0 0 0.12em;
}

.libreoffice-writer-document mark.libreoffice-writer-find-hit {
  background: #ffeb3b;
  color: inherit;
  padding: 0;
}

.libreoffice-writer-document mark.libreoffice-writer-find-hit--current {
  background: #ff9800;
  outline: 1px solid #e65100;
}

.libreoffice-writer-statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-family: Liberation Sans, Arial, sans-serif;
  background: #e8e8e8;
  border-top: 1px solid #c0c0c0;
  color: #333;
}

.libreoffice-writer-statusbar__sep {
  opacity: 0.5;
}

/* Плавающая панель «Найти» — не блокирует клики и прокрутку документа */
.libreoffice-writer-find-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
  background: transparent;
  padding: 0;
  overflow: visible;
}

.libreoffice-writer-find-dialog[hidden] {
  display: none !important;
}

.libreoffice-writer-find-dialog__panel {
  pointer-events: auto;
  width: min(548px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(90vh, 640px);
  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-writer-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-writer-find-dialog__header--dragging {
  cursor: grabbing;
}

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

.libreoffice-writer-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-writer-find-dialog__header-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #000;
}

.libreoffice-writer-find-dialog__header-close:active {
  background: rgba(0, 0, 0, 0.14);
}

.libreoffice-writer-find-dialog__body {
  padding: 10px 12px 8px;
}

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

.libreoffice-writer-find-dialog__label {
  justify-self: end;
  white-space: nowrap;
}

.libreoffice-writer-find-dialog__combo {
  position: relative;
  display: flex;
  min-width: 0;
}

.libreoffice-writer-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%);
  background-image: 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-writer-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-writer-find-dialog__input--not-found {
  background: #ff6d6d;
  border-color: #e05050;
}

.libreoffice-writer-find-dialog__not-found {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 6px 10px;
  background: #cce8ff;
  border: 1px solid #99c2eb;
  font-size: 13px;
  color: #1a1a1a;
}

.libreoffice-writer-find-dialog__not-found[hidden] {
  display: none;
}

.libreoffice-writer-find-dialog__not-found-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1c99ff;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.libreoffice-writer-find-dialog__field-options {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
}

.libreoffice-writer-find-dialog__check {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  cursor: pointer;
  font-size: 13px;
}

.libreoffice-writer-find-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
}

.libreoffice-writer-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-writer-find-dialog__more-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.libreoffice-writer-find-dialog__more-icon {
  display: inline-block;
  width: 18px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
}

.libreoffice-writer-find-dialog__more-panel {
  margin: 0 0 8px 20px;
}

.libreoffice-writer-find-dialog__more-panel[hidden] {
  display: none !important;
}

.libreoffice-writer-find-dialog__more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 20px;
}

.libreoffice-writer-find-dialog__more-grid .libreoffice-writer-find-dialog__check {
  white-space: normal;
}

.libreoffice-writer-find-dialog__format-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.libreoffice-writer-find-dialog__format-status {
  margin-left: auto;
  font-size: 13px;
  color: #444;
  white-space: nowrap;
}

.libreoffice-writer-find-dialog__format-status--error {
  color: #a40000;
  margin-left: 8px;
}

.libreoffice-writer-find-dialog__status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.libreoffice-writer-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-writer-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-writer-find-dialog__actions .libreoffice-writer-find-dialog__btn {
  min-width: 0;
}

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

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

.libreoffice-writer-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-writer-find-dialog__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ——— Тёмная тема (chrome как LibreOffice / Calc) ——— */
html[data-theme="dark"] .libreoffice-writer-container,
[data-theme="dark"] .libreoffice-writer-container {
  background: #2d2d2d;
  border-color: #555;
  color: #e8e8e8;
}

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

html[data-theme="dark"] .libreoffice-writer-container .univer-libre-title-bar__winbtn,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-title-bar__winbtn {
  color: #c0c0c0;
}

html[data-theme="dark"] .libreoffice-writer-container .univer-libre-title-bar__winbtn:hover,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-title-bar__winbtn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger,
html[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger {
  color: #e8e8e8;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger:hover,
html[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:hover,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger:hover,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger:focus-visible,
html[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:focus-visible,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-lo-menubar-trigger:focus-visible,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:focus-visible {
  outline-color: #6bb9ff;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:disabled,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-trigger:disabled {
  color: #777;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown {
  background: #2d2d2d;
  border-color: #555;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item {
  color: #f0f0f0;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled),
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:disabled,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:disabled {
  color: #888;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-sep,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-sep {
  background: #555;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-shortcut,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-shortcut {
  color: #aaa;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-check,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-check {
  color: #e0e0e0;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item--static .calc-menu-label,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item--static .calc-menu-label {
  color: #bbb;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled) .calc-menu-shortcut,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled) .calc-menu-shortcut {
  color: #ddd;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-check,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-check {
  color: #6bb9ff;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled) .calc-menu-check,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-item:hover:not(:disabled) .calc-menu-check {
  color: #fff;
}

/* Панель: mono-иконки переключаются в JS (тёмные в покое → светлые при hover). Меню: лёгкое усиление. */
html[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown .calc-menu-item img.calc-menu-icon,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown .calc-menu-item img.calc-menu-icon {
  transition: filter 0.12s ease, opacity 0.12s ease;
}

html[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown .calc-menu-item:hover:not(:disabled) img.calc-menu-icon,
[data-theme="dark"] .libreoffice-writer-container .calc-menu-dropdown .calc-menu-item:hover:not(:disabled) img.calc-menu-icon {
  filter: brightness(1.25);
}

/* Портированные в body выпадающие меню (если shell вынесет dropdown) */
html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown {
  background: #2d2d2d;
  border-color: #555;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item {
  color: #f0f0f0;
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item:hover:not(:disabled),
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item img.calc-menu-icon,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item img.calc-menu-icon {
  opacity: 0.5;
  filter: none;
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item:hover:not(:disabled) img.calc-menu-icon,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-item:hover:not(:disabled) img.calc-menu-icon {
  opacity: 1;
  filter: brightness(1.35);
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-sep,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-sep {
  background: #555;
}

html[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-shortcut,
[data-theme="dark"] body.neuroege-writer-page > .calc-menu-dropdown .calc-menu-shortcut {
  color: #aaa;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-toolbar,
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-toolbar,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar {
  background: #202020;
  border-bottom-color: #444;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-toolbar-sep,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-toolbar-sep {
  background: #555;
}

/* Кнопки панели: тёмный фон в покое → светлый при hover */
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn,
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn {
  background-color: #383838;
}

html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:hover,
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:hover,
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:focus-visible,
html[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:focus-visible,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:hover,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:hover,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .univer-libre-toolbar-btn:focus-visible,
[data-theme="dark"] .libreoffice-writer-container .univer-libre-toolbar .libreoffice-lo-toolbar__btn:focus-visible {
  background-color: #d8d8d8;
  outline: none;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-font-select,
html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-size-select,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-font-select,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-size-select {
  background: #333;
  border-color: #555;
  color: #f0f0f0;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-ruler,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-ruler {
  background: #2a2a2a
    repeating-linear-gradient(90deg, #555 0, #555 1px, transparent 1px, transparent 12px);
  border-bottom-color: #444;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-scroll,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-scroll {
  background: #3a3a3a;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator {
  background: #2a2a2a;
  border-left-color: #444;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__head,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__head {
  background: linear-gradient(180deg, #383838 0%, #2a2a2a 100%);
  border-bottom-color: #444;
  color: #ddd;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row {
  color: #ddd;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row:hover,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row:hover {
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row--active,
html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row--active:hover,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row--active,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__row--active:hover {
  background: #3d7ec9;
  color: #fff;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__empty,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__empty {
  color: #999;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__item--open > .libreoffice-writer-navigator__list::before,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__item--open > .libreoffice-writer-navigator__list::before,
html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::before,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::before,
html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::after,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__list .libreoffice-writer-navigator__list > .libreoffice-writer-navigator__item::after {
  border-color: #777;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__twisty:not(.libreoffice-writer-navigator__twisty--leaf),
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-navigator__twisty:not(.libreoffice-writer-navigator__twisty--leaf) {
  border-color: #888;
  background: #2a2a2a;
  color: #ddd;
}

/* Лист остаётся светлым — как в LibreOffice Writer в тёмной теме */
html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-page,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-page {
  background: #fff;
  color: #000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-document,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-document {
  color: #000;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-statusbar,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-statusbar {
  background: #202020;
  border-top-color: #444;
  color: #c8c8c8;
}

html[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-statusbar__sep,
[data-theme="dark"] .libreoffice-writer-container .libreoffice-writer-statusbar__sep {
  color: #666;
}

/* Диалог «Найти» */
html[data-theme="dark"] .libreoffice-writer-find-dialog__panel,
[data-theme="dark"] .libreoffice-writer-find-dialog__panel {
  background: #2d2d2d;
  border-color: #555;
  color: #f0f0f0;
}

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

html[data-theme="dark"] .libreoffice-writer-find-dialog__title,
[data-theme="dark"] .libreoffice-writer-find-dialog__title {
  color: #f0f0f0;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__header-close,
[data-theme="dark"] .libreoffice-writer-find-dialog__header-close {
  color: #ccc;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__header-close:hover,
[data-theme="dark"] .libreoffice-writer-find-dialog__header-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__label,
[data-theme="dark"] .libreoffice-writer-find-dialog__label {
  color: #ccc;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__input,
[data-theme="dark"] .libreoffice-writer-find-dialog__input {
  background: #1a1a1a;
  border-color: #555;
  color: #f0f0f0;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__input--not-found,
[data-theme="dark"] .libreoffice-writer-find-dialog__input--not-found {
  background: #b83232;
  border-color: #922626;
  color: #fff;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__not-found,
[data-theme="dark"] .libreoffice-writer-find-dialog__not-found {
  background: #1a3a52;
  border-color: #2a5a7a;
  color: #e8f4ff;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__not-found-icon,
[data-theme="dark"] .libreoffice-writer-find-dialog__not-found-icon {
  background: #3a9ad9;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__combo::after,
[data-theme="dark"] .libreoffice-writer-find-dialog__combo::after {
  border-left-color: #555;
  background-color: #333;
  background-image: linear-gradient(180deg, #444 0%, #333 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='%23ddd' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__format-status,
[data-theme="dark"] .libreoffice-writer-find-dialog__format-status {
  color: #bbb;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__format-status--error,
[data-theme="dark"] .libreoffice-writer-find-dialog__format-status--error {
  color: #ff8a8a;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__check,
[data-theme="dark"] .libreoffice-writer-find-dialog__check {
  color: #ddd;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__footer,
[data-theme="dark"] .libreoffice-writer-find-dialog__footer {
  border-top-color: #444;
  background: #2d2d2d;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__body,
[data-theme="dark"] .libreoffice-writer-find-dialog__body {
  background: #2d2d2d;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__btn,
[data-theme="dark"] .libreoffice-writer-find-dialog__btn {
  background: linear-gradient(180deg, #444 0%, #333 100%);
  border-color: #555;
  color: #f0f0f0;
}

html[data-theme="dark"] .libreoffice-writer-find-dialog__btn:hover:not(:disabled),
[data-theme="dark"] .libreoffice-writer-find-dialog__btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #505050 0%, #3a3a3a 100%);
}

html[data-theme="dark"] .libreoffice-writer-placeholder,
[data-theme="dark"] .libreoffice-writer-placeholder {
  color: #aaa;
}
