    * {
      box-sizing: border-box;
    }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
  overflow: hidden;
}

body.blue-editor-theme {
  background: #abd5fb;
}

body.green-editor-theme {
  background: #DDEBDD;
}

.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-shell {
  width: 100%;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  border: 0;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

    .toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0;
      padding: 0;
      background: linear-gradient(to bottom, #f5f5f5, #e7e7e7);
      border-bottom: 1px solid #bdbdbd;
      min-height: 44px;
    }

    .toolbar-wrap {
      position: relative;
      top: auto;
      z-index: 1000;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
      flex: 0 0 auto;
    }

    .toolbar-top,
    .toolbar-bottom {
      position: static;
      box-shadow: none;
    }

    .toolbar-top {
      border-bottom: 1px solid #d0d0d0;
      min-height: 40px;
    }

    .toolbar-top .group:last-child::after {
      display: none;
    }

    .toolbar-bottom {
      position: relative;
      border-bottom: 1px solid #bdbdbd;
      min-height: 44px;
    }

    .toolbar .group {
      display: flex;
      align-items: center;
      gap: 1px;
      padding: 4px 6px;
      position: relative;
    }

    .toolbar .group::after {
      content: "";
      width: 1px;
      height: 24px;
      background: #c6c6c6;
      margin-left: 6px;
    }

    .toolbar .group:last-child::after {
      display: none;
    }

    .toolbar .group.no-separator::after {
      display: none;
    }

    .tool-btn,
    .tool-select,
    .tool-color {
      height: 30px;
      border: 1px solid transparent;
      background: transparent;
      color: #222;
      font-size: 13px;
    }

    .tool-btn {
      min-width: 30px;
      padding: 0 8px;
      cursor: pointer;
      border-radius: 3px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }

    .tool-btn:hover,
    .tool-select:hover,
    .tool-color:hover {
      background: #fdfdfd;
      border-color: #b8b8b8;
    }

    .tool-btn:active,
    .tool-btn.active {
      background: #dcdcdc;
      border-color: #9f9f9f;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
    }

    .tool-btn:disabled {
      color: #9aa3ad;
      cursor: default;
      opacity: 1;
    }

    .tool-btn:disabled:hover {
      background: transparent;
      border-color: transparent;
    }

    .tool-btn.history-btn:disabled {
      color: #aeb6bf;
    }

    .tool-btn.text-btn {
      min-width: auto;
      padding: 0 10px;
      font-size: 12px;
    }

    .link-btn {
      width: 30px;
      min-width: 30px;
      height: 30px;
      padding: 0;
    }

    .link-toolbar-icon {
      width: 22px;
      height: 22px;
      display: block;
      color: #505357;
      pointer-events: none;
      flex: 0 0 auto;
    }

    .link-btn:hover .link-toolbar-icon {
      color: #202124;
    }

    .link-btn.active .link-toolbar-icon,
    .link-btn:active .link-toolbar-icon {
      color: #202124;
    }

    .text-style-btn {
      font-size: 18px;
    }

    .text-style-btn b,
    .text-style-btn i,
    .text-style-btn u {
      font-size: 18px;
      line-height: 1;
      font-weight: 400;
    }

    .text-style-btn b {
      font-weight: 700;
    }

    .tool-select {
      padding: 0 26px 0 8px;
      border-radius: 3px;
      border: 1px solid transparent;
      appearance: none;
      background-image:
        linear-gradient(45deg, transparent 50%, #444 50%),
        linear-gradient(135deg, #444 50%, transparent 50%);
      background-position:
        calc(100% - 14px) 12px,
        calc(100% - 9px) 12px;
      background-size: 5px 5px, 5px 5px;
      background-repeat: no-repeat;
      cursor: pointer;
    }

    .tool-select:focus {
      outline: none;
      border-color: #8ea9db;
      background-color: #fff;
    }

    .style-dropdown {
      position: relative;
    }

    .style-dropdown-trigger {
      min-width: 122px;
      max-width: 122px;
      height: 30px;
      padding: 0 10px;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border-radius: 8px;
      background: #fff;
      border: 1px solid #c6c6c6;
    }

    .style-dropdown-trigger:hover {
      background: #fff;
      border-color: #9aa0a6;
    }

    .style-dropdown.open .style-dropdown-trigger,
    .style-dropdown-trigger:active {
      background: #fff;
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .style-dropdown-label {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 13px;
      color: #202124;
    }

    .style-dropdown-arrow {
      font-size: 10px;
      color: #5f6368;
      flex: 0 0 auto;
    }

    .align-dropdown {
      position: relative;
    }

    .align-dropdown-trigger {
      min-width: 62px;
      height: 30px;
      padding: 0 10px;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      border-radius: 8px;
      background: #fff;
      border: 1px solid #c6c6c6;
    }

    .align-dropdown-trigger:hover {
      background: #fff;
      border-color: #9aa0a6;
    }

    .align-dropdown.open .align-dropdown-trigger,
    .align-dropdown-trigger:active {
      background: #f1f3f4;
      border-color: #c6c6c6;
    }

    .align-dropdown-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

    .align-dropdown-arrow {
      font-size: 10px;
      color: #202124;
      flex: 0 0 auto;
      pointer-events: none;
    }

    .align-svg {
      width: 22px;
      height: 22px;
      display: block;
      fill: #3c4043;
      pointer-events: none;
    }

    .align-svg * {
      pointer-events: none;
    }

    .align-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(60, 64, 67, .28);
      padding: 12px;
      z-index: 5000;
      min-width: 226px;
    }

    .align-dropdown.open .align-menu {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .align-menu-item {
      width: 44px;
      height: 44px;
      border: 0;
      background: #fff;
      border-radius: 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }

    .align-menu-item:hover {
      background: #f1f3f4;
    }

    .align-menu-item.active {
      background: #e8f0fe;
    }

    .align-menu-item.active .align-svg {
      fill: #174ea6;
    }

    .link-tools-group {
      position: static !important;
    }

    .link-dropdown {
      position: static;
    }

    .link-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 22px;
      right: 22px;
      width: auto;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(60, 64, 67, .28);
      padding: 12px;
      z-index: 5000;
    }

    .link-dropdown.open .link-menu {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .link-menu.mode-view .link-edit-row {
      display: none;
    }

    .link-menu.mode-edit .link-view-row,
    .link-menu.mode-add .link-view-row {
      display: none;
    }

    .link-menu.mode-view {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .link-edit-row,
    .link-view-row {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .link-input[readonly] {
      background: #f8f9fa;
      color: #5f6368;
      cursor: default;
    }

    .link-icon-btn {
      width: 36px;
      min-width: 36px;
      height: 36px;
      padding: 0;
      border: 1px solid #dadce0;
      border-radius: 8px;
      background: #fff;
      color: #3c4043;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .link-icon-btn:hover {
      background: #f1f3f4;
      border-color: #c6c6c6;
      color: #202124;
    }

    .link-icon-btn:active {
      background: #e8eaed;
      border-color: #c6c6c6;
    }

    .link-icon-btn.danger {
      color: #c5221f;
    }

    .link-icon-btn.danger:hover {
      background: #fce8e6;
      border-color: #f28b82;
      color: #a50e0e;
    }

    .link-action-icon {
      width: 18px;
      height: 18px;
      display: block;
      flex: 0 0 auto;
      pointer-events: none;
    }

    .link-copy-icon-ok {
      display: none;
    }

    .link-icon-btn.copy-success {
      color: #188038;
    }

    .link-icon-btn.copy-success .link-copy-icon-default {
      display: none;
    }

    .link-icon-btn.copy-success .link-copy-icon-ok {
      display: block;
    }

    .link-copy-success {
      color: #188038;
    }

    .link-input {
      flex: 1 1 auto;
      min-width: 0;
      height: 36px;
      border: 1px solid #dadce0;
      border-radius: 8px;
      background: #fff;
      padding: 0 12px;
      font-size: 14px;
      color: #202124;
      outline: none;
    }

    .link-input:focus {
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .link-apply-btn {
      flex: 0 0 auto;
      height: 36px;
      padding: 0 14px;
      border: 0;
      border-radius: 8px;
      background: #1a73e8;
      color: #fff;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
    }

    .link-apply-btn:hover {
      background: #1765cc;
    }

    .link-apply-btn:active {
      background: #1557b0;
    }

    .style-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      width: 260px;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 4px;
      box-shadow: 0 4px 16px rgba(60, 64, 67, .3);
      z-index: 5000;
      overflow: hidden;
    }

    .style-dropdown.open .style-menu {
      display: block;
    }

    .style-menu-item {
      width: 100%;
      min-height: 72px;
      border: 0;
      border-bottom: 1px solid #ececec;
      background: #fff;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 0 16px;
      text-align: left;
      cursor: pointer;
    }

    .style-menu-item:last-child {
      border-bottom: 0;
    }

    .style-menu-item:hover,
    .style-menu-item.active {
      background: #f1f3f4;
    }

    .style-menu-check {
      width: 16px;
      flex: 0 0 16px;
      color: #5f6368;
      font-size: 15px;
    }

    .style-menu-item:not(.active) .style-menu-check {
      visibility: hidden;
    }

    .style-menu-preview {
      flex: 1 1 auto;
      color: #202124;
    }

    .style-preview-normal {
      font-size: 14.6667px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      line-height: 1.15;
    }

    .style-preview-title {
      font-size: 34.6667px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      line-height: 1.15;
    }

    .style-preview-subtitle {
      font-size: 26.6667px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      line-height: 1.15;
    }

    .style-preview-h1 {
      font-size: 26.6667px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      line-height: 1.15;
    }

    .style-preview-h2 {
      font-size: 21.3333px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      line-height: 1.15;
    }

    .style-preview-h3 {
      font-size: 18.6667px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #434343;
      line-height: 1.15;
    }

    .doc-title {
      font-size: 34.6667px;
      /* 26pt */
      line-height: 1.15;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      margin: 0;
      padding-top: 0;
      padding-bottom: 4px;
      /* ~3pt */
    }

    .doc-subtitle {
      font-size: 26.6667px;
      /* 20pt */
      line-height: 1.15;
      font-weight: 400;
      font-family: Arial, sans-serif;
      color: #000000;
      margin: 0;
      padding-top: 26.6667px;
      /* 20pt */
      padding-bottom: 8px;
      /* ~6pt */
    }

    .font-dropdown {
      position: relative;
      margin-left: 6px;
    }

    .font-dropdown-trigger {
      min-width: 194px;
      height: 30px;
      padding: 0 12px;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      border-radius: 8px;
      background: #fff;
      border: 1px solid #c6c6c6;
    }

    .font-dropdown-trigger:hover {
      border-color: #9aa0a6;
      background: #fff;
    }

    .font-dropdown-trigger:active,
    .font-dropdown.open .font-dropdown-trigger {
      background: #fff;
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .font-dropdown-label {
      display: inline-block;
      min-width: 0;
      max-width: 145px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 16px;
      line-height: 1;
      color: #202124;
      text-align: left;
    }

    .font-dropdown-label:empty::before {
      content: "";
      display: inline-block;
      width: 100%;
    }

    .font-dropdown-arrow {
      font-size: 10px;
      color: #5f6368;
      flex: 0 0 auto;
    }

    .font-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      width: 320px;
      max-height: 720px;
      overflow-x: hidden;
      overflow-y: visible;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(60, 64, 67, .3);
      z-index: 4000;
    }

    .font-menu-header,
    .font-search-wrap,
    .font-menu-divider,
    .font-menu-scroll {
      width: 320px;
    }

    .font-dropdown.open .font-menu {
      display: block;
    }

    .font-menu-header {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 16px 18px 12px;
    }

    .font-menu-header-btn,
    .font-menu-header-link {
      border: 0;
      background: transparent;
      cursor: pointer;
      color: #202124;
    }

    .font-menu-header-btn {
      font-size: 18px;
      line-height: 1;
      padding: 0;
    }

    .font-menu-header-link {
      font-size: 14px;
      padding: 0;
    }

    .font-search-wrap {
      padding: 0 18px 12px;
    }

    .font-search-input {
      width: 100%;
      height: 36px;
      border: 1px solid #dadce0;
      border-radius: 8px;
      padding: 0 12px;
      font-size: 14px;
      color: #202124;
      background: #fff;
      outline: none;
    }

    .font-search-input:focus {
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .font-item-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      white-space: nowrap;
    }

    .font-variant-label {
      font-size: 11px;
      color: #5f6368;
      border: 1px solid #dadce0;
      border-radius: 999px;
      padding: 2px 6px;
      background: #f8f9fa;
    }

    .font-submenu-title {
      padding: 8px 16px 6px;
      font-size: 12px;
      font-weight: 700;
      color: #5f6368;
      text-transform: uppercase;
      letter-spacing: .03em;
    }

    .font-submenu-item.active {
      background: #e8f0fe;
    }

    .font-submenu-item-line1 {
      display: block;
      font-size: 15px;
      color: #202124;
    }

    .font-submenu-item-line2 {
      display: block;
      font-size: 12px;
      color: #5f6368;
      margin-top: 2px;
    }

    .font-menu-divider {
      height: 1px;
      margin: 0 18px;
      background: #e0e0e0;
    }

    .font-menu-scroll {
      max-height: 500px;
      overflow-y: auto;
      overflow-x: hidden;
      position: relative;
    }

    .font-menu-section {
      padding: 12px 0;
    }

    .font-menu-section-title {
      font-size: 12px;
      font-weight: 700;
      color: #444;
      padding: 0 18px 12px;
      letter-spacing: .02em;
    }

    #recentFontsList,
    #allFontsList {
      overflow: visible;
      position: static;
    }

    .font-item {
      width: 100%;
      min-width: 0;
      min-height: 48px;
      border: 0;
      background: transparent;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 0 18px;
      position: relative;
      overflow: hidden;
    }

    .font-item:hover {
      background: #f1f3f4;
    }

    .font-item-left {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      flex: 1 1 auto;
    }

    .font-item-check {
      width: 16px;
      flex: 0 0 16px;
      color: #5f6368;
      font-size: 14px;
      visibility: hidden;
    }

    .font-item.active .font-item-check {
      visibility: visible;
    }

    .font-item-name {
      min-width: 0;
      flex: 1 1 auto;
      text-align: left;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 16px;
      color: #202124;
    }

    .font-item-arrow {
      flex: 0 0 auto;
      font-size: 12px;
      color: #9aa0a6;
      visibility: hidden;
    }

    .font-item.has-variants .font-item-arrow {
      visibility: visible;
    }

    .font-item.has-variants:hover .font-item-arrow,
    .font-item.show-submenu .font-item-arrow {
      color: #5f6368;
    }

    .font-menu-empty {
      padding: 0 18px 12px;
      font-size: 13px;
      color: #777;
    }

    .font-submenu {
      position: fixed;
      width: 220px;
      max-width: 220px;
      max-height: 360px;
      overflow-y: auto;
      overflow-x: hidden;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(60, 64, 67, .25);
      padding: 8px 0;
      display: none;
      z-index: 9999;
    }

    .font-item.show-submenu>.font-submenu,
    .font-item.has-variants:hover>.font-submenu,
    .font-item.has-variants:focus-within>.font-submenu {
      display: block;
    }

    .font-submenu-item {
      width: 100%;
      min-width: 0;
      min-height: 40px;
      border: 0;
      background: transparent;
      cursor: pointer;
      text-align: left;
      padding: 0 16px;
      font-size: 15px;
      color: #202124;
      overflow: hidden;
    }

    .font-submenu-item:hover {
      background: #f1f3f4;
    }

    .font-size-control {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-left: 4px;
    }

    .font-size-btn {
      width: 24px;
      min-width: 24px;
      height: 24px;
      padding: 0;
      border: 1px solid transparent;
      background: transparent;
      color: #5f6368;
      border-radius: 4px;
      font-size: 18px;
      font-weight: 700;
      line-height: 1;
      letter-spacing: 0;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .font-size-btn:hover {
      background: #f1f3f4;
      border-color: #dadce0;
      color: #202124;
    }

    .font-size-btn:active {
      background: #e8eaed;
      border-color: #c7c9cc;
    }

    .font-size-input {
      width: 42px;
      height: 28px;
      border: 1px solid #c6c6c6;
      border-radius: 8px;
      background: #fff;
      text-align: center;
      font-size: 16px;
      line-height: 1;
      color: #202124;
      outline: none;
      padding: 0 4px;
    }

.font-size-dropdown {
  position: relative;
}

.font-size-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 28px;
  width: 82px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(60, 64, 67, .28);
  padding: 8px 0;
  z-index: 6000;
}

.font-size-dropdown.open .font-size-menu {
  display: block;
}

.font-size-menu-item {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 16px;
  color: #202124;
  padding: 0 10px;
}

.font-size-menu-item:hover {
  background: #f1f3f4;
}

.font-size-menu-item.active {
  background: #e8f0fe;
  color: #174ea6;
}

    .font-size-input:hover {
      border-color: #9aa0a6;
    }

    .font-size-input:focus {
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .font-size-input::-webkit-outer-spin-button,
    .font-size-input::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    .font-size-input[type="number"] {
      -moz-appearance: textfield;
      appearance: textfield;
    }

    .tool-color-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1px;
      min-width: 28px;
    }

    .tool-color-label {
      font-size: 16px;
      font-weight: 400;
      font-family: Arial, sans-serif;
      line-height: 1;
      color: #202124;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      letter-spacing: 0;
    }

    .tool-color {
      width: 22px;
      height: 4px;
      border: none;
      padding: 0;
      background: none;
      cursor: pointer;
      margin-top: 2px;
    }

    .color-dropdown {
      position: relative;
    }

    .color-trigger {
      min-width: 34px;
      width: 34px;
      height: 30px;
      padding: 2px 3px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
    }

    .color-trigger-letter {
      font-size: 15px;
      line-height: 1;
      color: #202124;
    }

    .color-trigger-underline {
      display: none;
    }

    .color-trigger-arrow {
      display: none;
    }

    .color-trigger-text .color-trigger-letter-text {
      font-size: 18px;
      font-weight: 700;
      color: #9900ff;
      line-height: 1;
    }

    .color-trigger-highlight .color-trigger-letter-highlight {
      width: 18px;
      height: 18px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 700;
      line-height: 1;
      letter-spacing: 0;
      color: #000000;
      background: #00ff00;
      border-radius: 2px;
    }

    .color-menu {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      width: 294px;
      background: #fff;
      border: 1px solid #dadce0;
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(60, 64, 67, .3);
      padding: 10px 8px 8px;
      z-index: 3000;
    }

    .color-dropdown.open .color-menu {
      display: block;
    }

    .color-grid {
      display: grid;
      grid-template-columns: repeat(10, 22px);
      gap: 6px;
      justify-content: start;
    }

    .color-swatch {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      border: 1px solid rgba(0, 0, 0, 0.08);
      cursor: pointer;
      padding: 0;
      background: transparent;
    }

    .color-swatch:hover {
      transform: scale(1.08);
      box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.28);
    }

    .color-swatch.white-swatch {
      border-color: #c9ccd1;
    }

    .color-menu-footer {
      display: flex;
      align-items: center;
      gap: 10px;
      padding-top: 10px;
      margin-top: 8px;
      border-top: 1px solid #eceff1;
    }

    .color-menu-clear-wrap {
      padding-top: 10px;
      margin-top: 8px;
      border-top: 1px solid #eceff1;
    }

    .color-menu-clear-btn {
      width: 100%;
      height: 34px;
      border: 1px solid #dadce0;
      background: #fff;
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
      color: #3c4043;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .color-menu-clear-btn:hover {
      background: #f1f3f4;
      border-color: #c6c6c6;
    }

    .color-menu-footer {
      display: flex;
      align-items: center;
      gap: 10px;
      padding-top: 10px;
      margin-top: 10px;
    }

    .color-menu-action {
      width: 28px;
      height: 28px;
      border: 1px solid transparent;
      background: transparent;
      border-radius: 50%;
      cursor: pointer;
      font-size: 18px;
      color: #5f6368;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .color-menu-action:hover {
      background: #f1f3f4;
      border-color: #dadce0;
      color: #202124;
    }

    .color-hidden-input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 0;
      height: 0;
    }

    .history-btn {
      min-width: 30px;
      width: 30px;
      padding: 0;
      font-size: 22px;
      font-weight: 900;
      line-height: 1;
      letter-spacing: -1px;
    }

    .dropdown {
      position: relative;
    }

    .dropdown-toggle {
      gap: 8px;
    }

.dropdown-divider {
  height: 1px;
  margin: 6px 0;
  background: #d0d0d0;
}

    .save-toggle {
      min-width: 42px;
      padding: 0;
    }

    .save-toggle-icon {
      color: #09244b;
    }

    .save-toggle-arrow {
      font-size: 10px;
      line-height: 1;
    }

    .dropdown-menu {
      display: none;
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      min-width: 190px;
      background: #f7f7f7;
      border: 1px solid #bdbdbd;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
      border-radius: 3px;
      padding: 4px;
      z-index: 2000;
    }

    .dropdown.open .dropdown-menu {
      display: block;
    }

    /* The File menu is shared by BLUE/GREEN/RED/PURPLE/ORANGE. Its command
       count is shell UI metadata (no document-format clause applies), so cap
       it to the actual viewport space instead of letting it disappear behind
       the status bar. Keyboard focus and touch/wheel scrolling stay native. */
    .file-dropdown-menu {
      max-height: var(--file-dropdown-max-height, calc(100dvh - 104px));
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
      touch-action: pan-y;
    }

    .dropdown-item {
      width: 100%;
      height: 30px;
      border: 1px solid transparent;
      background: transparent;
      color: #222;
      font-size: 13px;
      text-align: left;
      padding: 0 10px;
      cursor: pointer;
      border-radius: 3px;
    }

    .dropdown-item:hover {
      background: #fdfdfd;
      border-color: #b8b8b8;
    }

    .dropdown-item:active {
      background: #dcdcdc;
      border-color: #9f9f9f;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
    }


    .open-toggle {
      min-width: 56px;
      padding: 0 8px;
      gap: 8px;
    }

    .open-toggle-icon {
      font-size: 17px;
      line-height: 1;
    }




.green-grid-row {
  display: grid;
  grid-template-columns: 48px repeat(12, 120px);
}

.green-grid-header {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Одна порожня колонка замість усіх пропущених ліворуч від вікна: вона
   тримає місце, але не має ані рамки, ані тла — її не видно. */
.green-grid-gap {
  border: 0;
  background: transparent;
  padding: 0;
  pointer-events: none;
}

/* Тіло сітки має справжню висоту аркуша, а рядки в ньому — абсолютні. */
.green-grid-body {
  position: relative;
}

.green-corner,
.green-col-header,
.green-row-header,
.green-cell {
  border: 1px solid #d0d7de;
  min-height: 24px;
  box-sizing: border-box;
}

.green-corner,
.green-col-header,
.green-row-header {
  background: #eef4ee;
  font-size: 12px;
  color: #3c4043;
  display: flex;
  align-items: center;
  justify-content: center;
}

.green-row-header {
  position: sticky;
  left: 0;
  z-index: 2;
}

.green-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
}

.green-cell {
  background: #fff;
  padding: 4px 8px;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
}

.green-cell:focus {
  border-color: #34a853;
  box-shadow: inset 0 0 0 1px #34a853;
}

#ooxmlEngineHost,
#ooxmlGreenEngineHost,
#pdfViewerHost {
  display: none;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: auto;
}

.ooxml-engine-mode #ooxmlGreenEngineHost,
.ooxml-engine-mode #pdfViewerHost {
  display: none;
}

.ooxml-green-engine-mode #ooxmlEngineHost,
.ooxml-green-engine-mode #pdfViewerHost {
  display: none;
}

.ooxml-green-engine-mode #ooxmlGreenEngineHost {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ooxml-engine-mode #ooxmlEngineHost {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* PURPLE presentation (PPTX) editor host — same visibility model as the others. */
#ooxmlPurpleEngineHost {
  display: none;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: auto;
}

.ooxml-purple-engine-mode #ooxmlEngineHost,
.ooxml-purple-engine-mode #ooxmlGreenEngineHost,
.ooxml-purple-engine-mode #pdfViewerHost {
  display: none;
}

.ooxml-purple-engine-mode #ooxmlPurpleEngineHost {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ooxml-engine-mode #ooxmlPurpleEngineHost,
.ooxml-green-engine-mode #ooxmlPurpleEngineHost,
.pdf-viewer-mode #ooxmlPurpleEngineHost {
  display: none;
}

.pdf-red-page-error {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  z-index: 5;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4e5;
  color: #7a4b00;
  font-size: 13px;
}

.pdf-viewer-mode #ooxmlEngineHost,
.pdf-viewer-mode #ooxmlGreenEngineHost {
  display: none;
}

.pdf-viewer-mode #pdfViewerHost {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pdf-editor-host {
  position: relative;
  flex-direction: column;
  background: #eef1f7;
  color: #202124;
}

.pdf-editor-toolbar {
  flex: 0 0 92px;
  display: flex;
  min-width: 0;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  background: #ffffff;
  border-bottom: 1px solid #d7dce5;
  box-shadow: 0 1px 3px rgba(60,64,67,.08);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pdf-editor-toolbar::-webkit-scrollbar {
  height: 8px;
}

.pdf-editor-toolbar::-webkit-scrollbar-thumb {
  border: 2px solid #fff;
  border-radius: 999px;
  background: #aab4c2;
}

.pdf-editor-toolbar::-webkit-scrollbar-track {
  background: #f4f6f9;
}

.pdf-toolbar-spacer {
  flex: 1 1 auto;
  min-width: 18px;
}

.pdf-tool-separator {
  flex: 0 0 1px;
  margin: 14px 8px;
  background: #d7dce5;
}

.pdf-tool-tile,
.pdf-tool-btn,
.pdf-tool-close {
  border: 0;
  background: transparent;
  color: #202124;
  cursor: pointer;
  font-family: Arial, sans-serif;
}

.pdf-tool-tile {
  flex: 0 0 145px;
  display: grid;
  grid-template-columns: 1fr 18px;
  grid-template-rows: 42px 24px;
  align-items: center;
  justify-items: center;
  padding: 8px 10px;
  background: #fdece3;
  border-right: 1px solid #f4d7c8;
}

.pdf-tool-tile .pdf-tool-icon {
  grid-column: 1 / 3;
  font-size: 28px;
  line-height: 1;
}

.pdf-tool-tile .pdf-tool-label {
  grid-column: 1 / 2;
  font-size: 16px;
}

.pdf-tool-tile .pdf-tool-caret {
  grid-column: 2 / 3;
  font-size: 16px;
}

.pdf-tool-btn {
  flex: 0 0 auto;
  min-width: 70px;
  max-width: 96px;
  padding: 8px 7px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 0;
}

.pdf-tool-btn:hover,
.pdf-tool-close:hover {
  background: #f1f3f4;
}

.pdf-tool-btn.is-active {
  background: #e8f0fe;
  color: #174ea6;
}

/* РЕКОМЕНДОВАНИЙ РЕДАКТОР. RED дивиться на формат сторінки, густину тексту й
   кегль і каже, чим цей PDF є насправді: документом (DOCX, синій) чи
   презентацією (PPTX, фіолетовий). Кнопку лише ПІДСВІЧУЄМО — вибір лишається
   за людиною, тож іншу кнопку не блокуємо й не ховаємо. */
.pdf-tool-btn.is-recommended {
  position: relative;
  font-weight: 600;
}

.pdf-tool-btn.pdf-tool-to-docx.is-recommended {
  background: #e8f0fe;
  color: #174ea6;
  box-shadow: inset 0 0 0 1.5px #1a73e8;
}

.pdf-tool-btn.pdf-tool-to-pptx.is-recommended {
  background: #f3e8fd;
  color: #6b21a8;
  box-shadow: inset 0 0 0 1.5px #a06cd5;
}

.pdf-tool-btn.is-recommended::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pdf-tool-btn.is-disabled,
.pdf-tool-btn:disabled {
  opacity: .45;
  cursor: default;
}

.pdf-tool-btn.is-disabled:hover,
.pdf-tool-btn:disabled:hover {
  background: transparent;
}

.pdf-tool-icon {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  line-height: 1;
}

.pdf-tool-label {
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.1;
}

.pdf-tool-to-docx .pdf-tool-icon {
  font-size: 13px;
  font-weight: 800;
  border: 1px solid #b8d8c2;
  border-radius: 6px;
  padding: 4px 6px;
}

.pdf-tool-to-docx.is-active {
  background: #ecfdf3;
  color: #146c2e;
}

.pdf-tool-artifacts.is-active {
  background: #fff4e5;
  color: #7a4b00;
}

.pdf-tool-black-heart .pdf-tool-icon {
  color: #000;
  font-size: 24px;
  text-shadow: 0 0 0 #000;
}

.pdf-tool-black-heart.is-active {
  background: #f1f3f4;
  color: #000;
}

.pdf-tool-reset .pdf-tool-icon {
  color: #5f6368;
  font-size: 24px;
  font-weight: 700;
}

.pdf-tool-reset:hover .pdf-tool-icon {
  color: #202124;
}

.pdf-tool-close {
  flex: 0 0 44px;
  font-size: 22px;
  color: #5f6368;
}

.red-pdf-margin-overlay {
  position: absolute;
  pointer-events: none;
  box-sizing: border-box;
}

.red-pdf-margin-box {
  position: absolute;
  border: 2px solid rgba(46, 204, 113, 0.95);
  background: rgba(46, 204, 113, 0.14);
  box-sizing: border-box;
}

.red-pdf-margin-label {
  position: absolute;
  z-index: 1;
  max-width: 180px;
  padding: 3px 6px;
  border: 1px solid rgba(46, 204, 113, 0.8);
  border-radius: 4px;
  box-sizing: border-box;
  background: rgba(232, 255, 239, 0.96);
  color: #145a32;
  font: 12px/1.25 Arial, sans-serif;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.red-pdf-margin-label.red-pdf-margin-warning,
.red-pdf-margin-label[data-margin-side="warning"] {
  max-width: min(360px, calc(100% - 16px));
  border-color: rgba(245, 166, 35, 0.85);
  background: rgba(255, 248, 225, 0.98);
  color: #7a4b00;
}

.red-document-normalizer-debug {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
  pointer-events: none;
}

.red-document-normalizer-debug-item {
  display: grid;
  gap: 3px;
  color: #1f2937;
  font: 10px/1.2 Arial, sans-serif;
}

.red-document-normalizer-debug-item canvas {
  width: 120px;
  height: auto;
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
}

.red-pdf-lines-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.red-pdf-detected-line {
  stroke: rgba(139, 92, 246, 0.95);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.red-pdf-detected-line[data-structure-class="page-border"] {
  stroke: rgba(245, 158, 11, 0.96);
}

.red-pdf-detected-line[data-structure-class="table-line"] {
  stroke: rgba(14, 165, 233, 0.96);
}

.red-pdf-detected-line[data-structure-class="underline"] {
  stroke: rgba(239, 68, 68, 0.96);
}

.red-pdf-detected-line[data-structure-class="separator"] {
  stroke: rgba(34, 197, 94, 0.96);
}

.red-pdf-detected-line[data-structure-class="scan-edge"] {
  stroke: rgba(100, 116, 139, 0.96);
  stroke-dasharray: 7 5;
}

.red-pdf-detected-line[data-structure-class="unknown-line"] {
  stroke: rgba(139, 92, 246, 0.90);
}

.pdf-add-text-panel {
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 10px;
  background: #f8fafd;
  border-bottom: 1px solid #d7dce5;
  box-shadow: 0 1px 2px rgba(60,64,67,.06);
  overflow-x: auto;
  overflow-y: hidden;
}

.pdf-add-text-panel[hidden] {
  display: none;
}

.pdf-add-text-group {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-right: 1px solid #e2e6ee;
}

.pdf-add-text-group:first-child {
  padding-left: 2px;
}

.pdf-add-text-group:last-child {
  border-right: 0;
}

.pdf-add-text-icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #202124;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 1;
}

.pdf-add-text-icon-btn:hover,
.pdf-add-text-icon-btn.is-selected {
  background: #eef3ff;
}

.pdf-add-text-icon-btn.is-selected {
  color: #ff3b35;
}

.pdf-add-text-symbol {
  font-size: 27px;
  font-family: Georgia, serif;
}

.pdf-add-text-small-square {
  position: absolute;
  right: 7px;
  bottom: 6px;
  width: 13px;
  height: 13px;
  background: #2f3542;
  border-radius: 2px;
}

.pdf-add-text-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #000;
}

.pdf-add-text-overlap-squares::before,
.pdf-add-text-overlap-squares::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 2px;
}

.pdf-add-text-overlap-squares::before {
  left: 10px;
  top: 9px;
  background: #2f3542;
}

.pdf-add-text-overlap-squares::after {
  left: 18px;
  top: 17px;
  border: 2px solid #2f3542;
  background: #f8fafd;
}

.pdf-add-text-no-fill {
  width: 24px;
  height: 24px;
  border: 2px solid #c7cdd8;
  border-radius: 50%;
  background: linear-gradient(135deg, transparent 45%, #ff3b35 47%, #ff3b35 53%, transparent 55%);
}

.pdf-add-text-opacity-icon {
  width: 25px;
  height: 25px;
  border: 2px solid #202124;
  border-radius: 50%;
  background: repeating-linear-gradient(90deg, #202124 0 3px, transparent 3px 7px);
}

.pdf-add-text-double-t {
  font-size: 28px;
  letter-spacing: -6px;
}

.pdf-add-text-double-t span {
  font-size: 19px;
  vertical-align: -4px;
}

.pdf-add-text-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.pdf-add-text-select {
  height: 38px;
  min-width: 92px;
  border: 0;
  border-radius: 4px;
  padding: 0 30px 0 10px;
  background: transparent;
  color: #202124;
  font: 16px Arial, sans-serif;
  cursor: pointer;
}

.pdf-add-text-select:hover,
.pdf-add-text-select:focus {
  background: #eef3ff;
  outline: none;
}

.pdf-add-text-font-select {
  min-width: 150px;
}

.pdf-add-text-size-select {
  min-width: 82px;
}

.pdf-add-text-tour {
  position: absolute;
  z-index: 80;
  width: 450px;
  max-width: calc(100% - 36px);
  padding: 26px 26px 22px;
  border-radius: 14px;
  background: #1f1f1f;
  color: #fff;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  font-family: Arial, sans-serif;
}

.pdf-add-text-tour[hidden] {
  display: none;
}

.pdf-add-text-tour-arrow {
  position: absolute;
  top: -13px;
  left: 54px;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 15px solid #1f1f1f;
}

.pdf-add-text-tour-title {
  margin-bottom: 14px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
}

.pdf-add-text-tour-body {
  max-width: 390px;
  min-height: 76px;
  color: rgba(255,255,255,.86);
  font-size: 23px;
  line-height: 1.35;
}

.pdf-add-text-tour-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.pdf-add-text-tour-counter {
  margin-right: auto;
  color: rgba(255,255,255,.55);
  font-size: 20px;
}

.pdf-add-text-tour-skip,
.pdf-add-text-tour-next {
  min-width: 90px;
  min-height: 50px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.pdf-add-text-tour-skip {
  background: #2b2b2b;
}

.pdf-add-text-tour-next {
  min-width: 124px;
  background: #ff4842;
}

.pdf-add-text-tour-skip:hover,
.pdf-add-text-tour-next:hover {
  filter: brightness(1.08);
}

.pdf-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  background: #eef1f7;
  overflow: hidden;
}

.pdf-thumbnails-panel {
  flex: 0 0 224px;
  min-width: 168px;
  max-width: 280px;
  border-right: 1px solid #d8dde6;
  background: #f4f6fb;
  overflow: auto;
  padding: 16px 14px;
}

.pdf-thumbnails-panel.is-collapsed {
  display: none;
}

.pdf-thumbnails-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* Авторський display перебиває атрибут hidden із UA-стилів — повертаємо його
   силу, інакше перемикання вкладок панелі нічого б не ховало. */
.pdf-thumbnails-list[hidden],
.pdf-outline-pane[hidden],
.pdf-outline-children[hidden] {
  display: none;
}

/* --- BLUE: бічна панель (мініатюри + зміст) ------------------------------ */

/* За замовчуванням обгортка «прозора» для розкладки — тоді решта режимів
   (GREEN / PURPLE / RED) бачать #ooxmlEngineHost так само, як раніше. */
.blue-workspace-row { display: contents; }

.ooxml-engine-mode .blue-workspace-row {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.blue-side-panel {
  flex: 0 0 232px;
  min-width: 176px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #cfd9e8;
  background: #eef4fd;
  overflow: auto;
  padding: 16px 14px;
}

.blue-side-panel[hidden] { display: none; }

.blue-side-panel .pdf-side-tabs { background: #eef4fd; border-bottom-color: #d3ddec; }
.blue-side-panel .pdf-side-tab:hover { background: #e0eafa; }

.blue-thumbnails-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.blue-thumbnails-list[hidden] { display: none; }

.blue-thumb-card {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #202124;
  font: inherit;
}

/* Мініатюра — жива копія сторінки, стиснена трансформацією: жодного повторного
   рендеру й жодного canvas, бо сторінки BLUE — це DOM. */
.blue-thumb-page {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #c9d4e6;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(16, 40, 80, 0.12);
}

.blue-thumb-page > * {
  transform-origin: top left;
  pointer-events: none;
}

.blue-thumb-number {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 9px;
  border-radius: 9px;
  font-size: 11.5px;
  color: #4a5364;
}

.blue-thumb-card.is-active .blue-thumb-page {
  border-color: #1a56b8;
  box-shadow: 0 0 0 2px rgba(26, 86, 184, 0.35);
}

.blue-thumb-card.is-active .blue-thumb-number {
  background: #d7e3fa;
  color: #10357e;
  font-weight: 600;
}

/* --- Бічна панель: вкладки «Мініатюри» / «Зміст» ------------------------- */

.pdf-side-tabs {
  position: sticky;
  top: -16px;                       /* компенсує padding панелі при скролі */
  z-index: 2;
  display: flex;
  gap: 4px;
  margin: -16px -14px 14px;
  padding: 10px 14px 0;
  background: #f4f6fb;
  border-bottom: 1px solid #dfe3ec;
}

.pdf-side-tab {
  flex: 1 1 0;
  border: 0;
  background: transparent;
  padding: 7px 6px 8px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #5f6774;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
}

.pdf-side-tab:hover { background: #e9edf6; color: #26303f; }

.pdf-side-tab.is-active {
  color: #1a56b8;
  border-bottom-color: #1a56b8;
}

.pdf-side-tab.is-empty { color: #9aa2b1; }

.pdf-side-tab:focus-visible {
  outline: 2px solid #1a56b8;
  outline-offset: -2px;
}

/* --- Дерево змісту (/Outlines) ------------------------------------------ */

.pdf-outline-pane { padding-bottom: 8px; }

.pdf-outline-empty {
  margin: 12px 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #6b7280;
}

.pdf-outline-line {
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.pdf-outline-twisty {
  flex: 0 0 16px;
  width: 16px;
  height: 22px;
  margin-top: 1px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #7a8394;
  font-size: 11px;
  line-height: 22px;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.pdf-outline-twisty.is-empty { cursor: default; }
.pdf-outline-twisty[aria-expanded='true'] { transform: rotate(90deg); }
.pdf-outline-twisty:hover:not(.is-empty) { color: #1a56b8; }

.pdf-outline-row {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 3px 6px;
  border-radius: 5px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: start;
  color: #2b3442;
  cursor: pointer;
}

.pdf-outline-row:hover:not([disabled]) { background: #e4ebfa; }

.pdf-outline-row.is-current {
  background: #dbe6fb;
  color: #10357e;
  font-weight: 600;
}

.pdf-outline-row.is-bold { font-weight: 700; }
.pdf-outline-row.is-italic { font-style: italic; }

/* Запис без призначення (лише заголовок гілки) — не інтерактивний. */
.pdf-outline-row.is-unlinked { color: #6b7280; cursor: default; }

.pdf-outline-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pdf-outline-page {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #8b93a2;
}

.pdf-outline-row.is-current .pdf-outline-page { color: #3a63b8; }

.pdf-thumb-card {
  width: 150px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  text-align: center;
  color: #202124;
}

.pdf-thumb-page {
  /* Розмір задається ІНЛАЙН у renderThumbnails під реальні пропорції кожної
     сторінки (книжкова/альбомна/квадратна) у межах бокса 150×196. Фіксовані
     значення тут — лише запасний варіант, якщо інлайн не виставлено. */
  width: 150px;
  height: 196px;
  max-width: 150px;
  max-height: 196px;
  box-sizing: border-box;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(60,64,67,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.pdf-thumb-page-inner {
  width: 100%;
  height: 100%;
  border: 1px solid #eef0f4;
  background:
    linear-gradient(#d9e7fb 0 0) 50% 18% / 70px 5px no-repeat,
    linear-gradient(#202124 0 0) 50% 32% / 128px 3px no-repeat,
    linear-gradient(#202124 0 0) 50% 39% / 155px 3px no-repeat,
    linear-gradient(#202124 0 0) 50% 46% / 140px 3px no-repeat,
    linear-gradient(#202124 0 0) 50% 60% / 160px 3px no-repeat,
    linear-gradient(#202124 0 0) 50% 67% / 120px 3px no-repeat,
    #fff;
}

.pdf-thumb-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  margin-top: 7px;
  border-radius: 999px;
  background: #d8dee8;
  color: #202124;
  font-size: 12px;
}

.pdf-thumb-card.is-active .pdf-thumb-page {
  outline: 3px solid #8ab4f8;
}

.pdf-thumb-card.is-active .pdf-thumb-number {
  background: #c9d8f2;
  color: #174ea6;
  font-weight: 700;
}

.pdf-editor-workspace {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #eef1f7;
}

.pdf-editor-filebar {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  color: #5f6368;
  background: #eef1f7;
  border-bottom: 1px solid rgba(216,221,230,.7);
}

.pdf-editor-file-title {
  min-width: 0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #202124;
  font-size: 13px;
  font-weight: 600;
}

.pdf-editor-tool-status {
  font-size: 13px;
}

.pdf-red-viewer-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  background: #eef1f7;
  overflow: hidden;
}

.pdf-red-viewer-surface {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: #eef1f7;
  overflow: auto;
  padding: 32px 36px 32px;
}

.pdf-red-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  min-height: 100%;
}

.pdf-red-page {
  position: relative;
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid #d0d5dd;
  box-shadow: 0 4px 16px rgba(60,64,67,.22);
}

.pdf-red-page-canvas {
  position: absolute;
  inset: 0;
  display: block;
  background: #ffffff;
}

.pdf-red-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  user-select: text;
  pointer-events: auto;
}

.pdf-red-text-item {
  position: absolute;
  display: block;
  white-space: pre;
  color: transparent;
  font-family: Arial, sans-serif;
  line-height: 1;
  transform-origin: 0 0;
}

/* Клікабельні link-анотації (URL/email) поверх тексту. Прозорі, але клікабельні;
   ледь помітна підсвітка на наведення — як у браузерних переглядачах PDF. */
/* Пункти «Зберегти» для бланка: назва варіанта плюс рядок про наслідок —
   без нього «зі змінами» і «зі змінами (без редагування)» не розрізнити. */
.dropdown-item.red-save-form-item {
  /* Базовий пункт має ФІКСОВАНУ висоту 30px під один рядок — тут рядків два,
     тож висоту віддаємо вмісту, інакше пояснення налазить на наступний пункт. */
  height: auto;
  min-height: 30px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 7px 10px;
  line-height: 1.25;
  /* Назви варіантів довгі, і перенос посеред «(без редагування)» читається
     погано — тож меню під бланк ширше за звичайне. */
  min-width: 252px;
  white-space: nowrap;
}

.dropdown-item.red-save-form-item small {
  color: #6b7c93;
  font-size: 11px;
}

/* ПОЛЯ ФОРМИ (ISO 32000-1 §12.7) — шар інтерфейсу поверх канви.
   Сіре тло тут малюємо МИ: у текстових полів цього документа немає ні /MK, ні
   /BG (у галочок є), тож показати, куди можна писати, — робота читача, як і в
   переглядачах. У растр це не потрапляє: канва лишається тим, що у файлі. */
.pdf-red-form-field {
  /* Тло НЕПРОЗОРЕ — навмисно. Значення поля малює і канва (з вигляду), і цей
     шар; якби плашка просвічувала, текст двоївся б із півпіксельним зсувом.
     Переглядачі роблять так само: їхні поля теж закривають те, що під ними. */
  background: #ebedf1;
  box-shadow: inset 0 0 0 1px rgba(90, 115, 150, 0.30);
  border-radius: 1px;
  pointer-events: auto;
  cursor: text;
  overflow: hidden;
  white-space: pre;
  line-height: 1;
  display: flex;
  align-items: center;
  padding: 0 2px;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
  transition: background 120ms ease, box-shadow 120ms ease;
}

/* Наведення й фокус — блакитним, тим самим сигналом, що й посилання.
   Сіре при цьому МАЄ ЗНИКАТИ: два блідих відтінки різняться так слабко, що
   підсвітки не видно взагалі. Тому тут не домішування, а заміна — виразний
   блакитний і помітно темніша рамка; щойно курсор іде, сіре повертається. */
.pdf-red-form-field:hover,
.pdf-red-form-field:focus {
  background: #bcd8ff;
  box-shadow: inset 0 0 0 1.5px #2f6fd0;
  outline: none;
}

/* Галочка: квадрат по центру поля, «пташка» — псевдоелементом. */
.pdf-red-form-field.is-check {
  cursor: pointer;
  justify-content: center;
  padding: 0;
}

.pdf-red-form-field.is-check.is-checked::before {
  content: '✓';
  font-size: 0.95em;
  line-height: 1;
  color: #111;
}

/* Поле лише для читання (/Ff біт 1) заповнити не можна — не обіцяємо цього
   ні виглядом, ні курсором. */
.pdf-red-form-field.is-readonly {
  background: rgba(233, 237, 247, 0.55);
  box-shadow: inset 0 0 0 1px rgba(120, 120, 120, 0.18);
  cursor: default;
}

.pdf-red-link {
  position: absolute;
  display: block;
  cursor: pointer;
  pointer-events: auto;
  border-radius: 2px;
}

.pdf-red-link:hover,
.pdf-red-autolink-hover {
  background: rgba(26, 115, 232, 0.16);
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.45);
}

/* Поки триває протягування виділення, лінки не мають перехоплювати курсор —
   інакше каретка чіпляється за порожній <a> і виділення рветься (див.
   _installSelectionDragGuard). Клік без руху лінки лишає клікабельними. */
.pdf-red-selecting a.pdf-red-link,
.pdf-red-selecting a.pdf-red-autolink,
.pdf-red-selecting .pdf-red-qr {
  /* !important — лінки несуть inline `pointer-events:auto` (для роботи без
     свіжого main.css), і лише !important перекриває inline під час виділення. */
  pointer-events: none !important;
}

/* Плаваючий тулбар дій над посиланням (скопіювати / QR) — див.
   src/js/ui/red-link-actions.js. position:fixed, координати з getBoundingRect. */
.red-link-actions {
  position: fixed;
  z-index: 2147483000;
  display: none;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(13, 31, 51, 0.22), 0 0 0 1px rgba(13, 31, 51, 0.08);
}
.red-link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1a73e8;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.red-link-action:hover { background: rgba(26, 115, 232, 0.12); }
.red-link-action.is-copied { color: #1e8e3e; }

/* BLUE: hover показує лише download; click додає окрему рамку з resize-маркерами. */
.red-image-actions {
  position: fixed;
  z-index: 2147483000;
  display: none;
  padding: 3px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(13, 31, 51, 0.22), 0 0 0 1px rgba(13, 31, 51, 0.08);
}
.red-image-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1c274c;
  cursor: pointer;
}
.red-image-action:hover {
  color: #1a73e8;
  background: rgba(26, 115, 232, 0.12);
}
.red-image-crop-frame {
  position: relative;
  display: inline-block;
  overflow: hidden;
  box-sizing: content-box;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 0;
  vertical-align: middle;
}
.red-image-crop-frame > img.ooxml-drawing {
  position: absolute;
  display: block;
  max-width: none;
  margin: 0;
}
.red-image-selection-box {
  /* Рамка стоїть у контейнері зображення, а не «до вікна»: інакше вона
     лишається на місці щоразу, коли сторінка зсувається (з'явилася панель,
     змінився масштаб). Див. shell/src/core/selection-anchor.js. */
  position: absolute;
  z-index: 23000;
  display: none;
  box-sizing: border-box;
  border: 2px solid #1a73e8;
  pointer-events: none;
}
.red-image-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border: 2px solid #1a73e8;
  border-radius: 50%;
  background: #fff;
  pointer-events: auto;
  touch-action: none;
}
.red-image-resize-handle.is-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.red-image-resize-handle.is-n { left: 50%; top: -6px; transform: translateX(-50%); cursor: ns-resize; }
.red-image-resize-handle.is-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.red-image-resize-handle.is-e { right: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.red-image-resize-handle.is-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.red-image-resize-handle.is-s { left: 50%; bottom: -6px; transform: translateX(-50%); cursor: ns-resize; }
.red-image-resize-handle.is-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.red-image-resize-handle.is-w { left: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.red-image-selection-box.is-crop-mode {
  border-color: #202124;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle {
  border: 0;
  border-radius: 1px;
  background: #202124;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-n,
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-s {
  width: 24px;
  height: 6px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-n {
  top: -4px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-s {
  bottom: -4px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-e,
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-w {
  width: 6px;
  height: 24px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-e {
  right: -4px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-w {
  left: -4px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-nw,
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-ne,
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-se,
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-sw {
  width: 18px;
  height: 18px;
  border-style: solid;
  border-color: #202124;
  border-radius: 0;
  background: transparent;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-nw {
  left: -4px;
  top: -4px;
  border-width: 5px 0 0 5px;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-ne {
  right: -4px;
  top: -4px;
  border-width: 5px 5px 0 0;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-se {
  right: -4px;
  bottom: -4px;
  border-width: 0 5px 5px 0;
}
.red-image-selection-box.is-crop-mode .red-image-resize-handle.is-sw {
  left: -4px;
  bottom: -4px;
  border-width: 0 0 5px 5px;
}

.red-image-format-window {
  width: var(--side-modal-width);
  height: 390px;
}
.red-image-format-header {
  padding: 8px;
  gap: 8px;
}
.red-image-format-tabs,
.red-image-format-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.red-image-format-tab.is-active {
  color: #fff;
  border-color: #1f2328;
  background: #1f2328;
}
.red-image-format-body {
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.red-image-size-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.red-image-size-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.red-image-size-title-row .ooxml-text-format-section-title {
  margin-bottom: 0;
}
.red-image-unit-control .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.red-image-unit-control select {
  height: 30px;
  min-width: 64px;
  padding: 0 24px 0 10px;
  border: 1px solid #c8cdd3;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  font: 600 12px Arial, sans-serif;
  cursor: pointer;
  outline: none;
}
.red-image-unit-control select:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.14);
}
.red-image-size-grid,
.red-image-crop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.red-image-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #5f6368;
  font-size: 12px;
}
.red-image-field input {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid #c8cdd3;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  font: 14px Arial, sans-serif;
  outline: none;
}
.red-image-field input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.14);
}
.red-image-aspect-toggle {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 0 12px;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  background: #fff;
  color: #3c4043;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.red-image-aspect-toggle.is-active {
  color: #174ea6;
  border-color: #8ab4f8;
  background: #e8f0fe;
}
.red-image-aspect-chain { font-size: 16px; }
.red-image-aspect-state {
  font-size: 11px;
  font-weight: 600;
}
.red-image-size-note,
.red-image-crop-note {
  margin-top: 12px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}
.red-image-modal-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin-top: auto;
  padding: 0 16px;
  border: 1px solid #c8cdd3;
  border-radius: 10px;
  background: #fff;
  color: #1a73e8;
  font: 600 13px Arial, sans-serif;
  cursor: pointer;
}
.red-image-modal-download:hover {
  border-color: #8ab4f8;
  background: #e8f0fe;
}
.red-image-modal-download svg {
  flex: 0 0 auto;
}
.red-image-reset-crop {
  min-height: 38px;
  margin-top: 16px;
  padding: 0 16px;
  border: 1px solid #c8cdd3;
  border-radius: 999px;
  background: #fff;
  color: #1a73e8;
  font-weight: 600;
  cursor: pointer;
}
.red-image-reset-crop:hover { background: #f3f7ff; }

/* BLUE application chrome: persistent command bar based on the compact
   desktop-editor layout. Contextual image commands are mounted below it. */
.red-app-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.toolbar.toolbar-top {
  --red-app-toolbar-icon-size: 24px;
  min-height: 58px;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 5px 8px;
  border-bottom: 1px solid #d9dde3;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: none;
}
.toolbar-top .group {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0 5px;
}
.toolbar-top .group::after {
  height: 34px;
  margin-left: 8px;
  background: #e0e3e7;
}
.toolbar-top .tool-btn {
  min-width: 38px;
  height: 42px;
  gap: 7px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  white-space: nowrap;
}
.toolbar-top .tool-btn:hover { background: #f3f6fa; }
.toolbar-top .red-app-history-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toolbar-top .history-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
}
.toolbar-top .save-toggle {
  width: 42px;
  min-width: 42px;
  padding: 0;
}
.red-app-history-icon {
  display: block;
  width: 24px;
  height: 24px;
}
.history-btn:disabled .red-app-history-icon { opacity: 0.38; }
.toolbar-top .red-app-print-btn {
  width: 42px;
  min-width: 42px;
  padding: 0;
}
.save-toggle-icon,
.red-app-print-icon {
  display: block;
  width: var(--red-app-toolbar-icon-size);
  height: var(--red-app-toolbar-icon-size);
}
.toolbar-top .file-toggle {
  border: 1px solid #d7dce2;
  background: #fff;
}
.red-app-command-icon,
.red-app-command-label + [aria-hidden="true"] { color: #2e3338; }
.red-app-document-title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  gap: 6px;
  color: #747a82;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.red-app-document-title strong {
  color: #181b1f;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toolbar-top > .group.no-separator:not(.red-app-toolbar-actions),
.red-app-toolbar-actions {
  margin-left: auto;
  gap: 2px !important;
}
.red-app-format-btn {
  min-width: 62px !important;
  height: 46px !important;
  flex-direction: column;
  gap: 1px !important;
  border: 1px solid #a8c7fa !important;
  background: #e8f0fe !important;
  color: #0b57d0 !important;
}
.red-app-format-btn > span:first-child { font-size: 20px; line-height: 18px; }
.red-app-format-btn .red-app-command-label { font-size: 11px; }

.red-image-context-toolbar[hidden] { display: none; }
.red-image-context-toolbar {
  position: relative;
  z-index: 1200;
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  min-height: 60px;
  padding: 7px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #d8dce2;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 5px rgba(42, 47, 54, 0.06);
}
.red-image-ribbon-control,
.red-image-ribbon-button {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 106px;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid #e0e3e7;
  background: transparent;
  color: #202124;
  font: 13px Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.red-image-ribbon-control-wide { min-width: 176px; }
.red-image-ribbon-control select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.red-image-ribbon-icon,
.red-image-ribbon-button > span:first-child { font-size: 22px; }
.red-image-ribbon-button:hover,
.red-image-ribbon-button.is-active,
.red-image-ribbon-control:hover { background: #edf4ff; color: #0b57d0; }
.red-image-ribbon-more { min-width: 76px; border-right: 0; font-size: 18px; }

/* Full-height image inspector. While it is active, the document viewport
   reserves its width and the previous side-modal stack is temporarily hidden. */
.red-image-format-modal {
  top: 142px;
  right: 0;
  bottom: 40px;
  width: 360px;
  z-index: 24500;
}
.red-image-format-modal .red-image-format-window {
  top: 0 !important;
  right: 0 !important;
  width: 360px;
  height: 100%;
  border: 0;
  border-left: 1px solid #d7dce2;
  border-radius: 0;
  box-shadow: -5px 0 18px rgba(43, 49, 57, 0.08);
  background: #f8f9fb;
}
.red-image-format-header {
  height: 48px;
  padding: 0 14px;
  background: #fff;
}
.red-image-format-title { font-size: 14px; color: #25292e; }
.red-image-format-body {
  display: block;
  padding: 10px;
  background: #f8f9fb;
}
.editor-shell.red-image-editing #ooxmlEngineHost { padding-right: 360px; }
.editor-shell.red-image-editing .ruler-bar { padding-right: 360px; }

.red-image-inspector-section {
  margin: 0 0 9px;
  overflow: hidden;
  border: 1px solid #dfe3e8;
  border-radius: 9px;
  background: #fff;
}
.red-image-inspector-section.is-active { border-color: #86adf5; }
.red-image-inspector-section > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 34px 0 12px;
  color: #30343a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.red-image-inspector-section > summary::-webkit-details-marker { display: none; }
.red-image-inspector-section > summary::after {
  content: '⌄';
  position: absolute;
  right: 13px;
  top: 10px;
  font-size: 17px;
  transform: rotate(-90deg);
  transition: transform .15s ease;
}
.red-image-inspector-section[open] > summary::after { transform: rotate(0); }
.red-image-inspector-section-body { padding: 0 12px 12px; }

/* ── BLUE: table modal — same visual system as Format / References ──────── */
.blue-table-inspector-modal {
  inset: 0;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  z-index: 24500;
  pointer-events: none;
}
.blue-table-inspector-modal .blue-table-inspector-window {
  top: var(--side-modal-top, 82px) !important;
  right: 16px;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - var(--side-modal-top, 82px) - 56px);
  height: auto;
  border: 1px solid var(--ooxml-modal-border, #d0d7de);
  border-radius: 12px;
  box-shadow: 0 14px 38px rgba(24, 35, 52, .18);
  background: #fff;
  pointer-events: auto;
  overflow: hidden;
}
.blue-table-inspector-modal.ooxml-side-modal-left .blue-table-inspector-window {
  right: auto;
  left: 16px;
}
.blue-table-inspector-header {
  min-height: 52px;
  height: auto;
  padding: 6px 8px;
  background: #fff;
}
.blue-table-inspector-heading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  font-weight: 700;
}
.blue-table-inspector-heading > span:first-child { font-size: 20px; }
.blue-table-inspector-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.blue-table-selection-label {
  max-width: 142px;
  overflow: hidden;
  color: #68707a;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blue-table-inspector-body {
  display: block;
  max-height: calc(100vh - var(--side-modal-top, 82px) - 112px);
  padding: 10px 12px 14px;
  background: #fff;
  overflow: auto;
}
.blue-table-inspector-section {
  margin: 0 0 10px;
  border: 1px solid #e2e7ed;
  border-radius: 9px;
  background: #fbfcfe;
  overflow: hidden;
}
.blue-table-inspector-section > summary {
  min-height: 38px;
  padding: 10px 36px 9px 12px;
  color: #29323d;
  font-size: 12px;
  font-weight: 700;
}
.blue-table-inspector-section > .red-image-inspector-section-body { padding: 2px 12px 12px; }
.blue-table-inspector-section.is-disabled { opacity: .64; }
.blue-table-inspector-section button,
.blue-table-inspector-section input,
.blue-table-inspector-section select,
.blue-table-delete-button {
  font: 12px Arial, sans-serif;
}
.blue-table-picker {
  display: grid;
  width: max-content;
  grid-template-columns: repeat(8, 22px);
  gap: 2px;
  margin: 2px auto 7px;
}
.blue-table-picker-cell {
  width: 22px;
  height: 18px;
  padding: 0;
  border: 1px solid #b9c0c9;
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}
.blue-table-picker-cell:hover,
.blue-table-picker-cell.is-hot {
  border-color: #0b57d0;
  background: #d8e8ff;
}
.blue-table-picker-hint {
  min-height: 17px;
  margin-bottom: 8px;
  color: #68707a;
  font-size: 11px;
  text-align: center;
}
.blue-table-create-row,
.blue-table-field-row,
.blue-table-color-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}
.blue-table-create-row { grid-template-columns: 1fr 1fr auto; }
.blue-table-create-row label,
.blue-table-field-row label,
.blue-table-color-row label,
.blue-table-stacked-field,
.blue-table-range-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #59616b;
  font-size: 11px;
}
.blue-table-create-row input,
.blue-table-field-row input,
.blue-table-field-row select,
.blue-table-color-row input[type="number"],
.blue-table-stacked-field input,
.blue-table-stacked-field textarea,
.blue-table-range-field input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid #cbd1d8;
  border-radius: 7px;
  background: #fff;
  color: #25292e;
  outline: none;
}
.blue-table-stacked-field textarea {
  height: 68px;
  padding: 8px;
  resize: vertical;
}
.blue-table-create-row input:focus,
.blue-table-inspector-section input:focus,
.blue-table-inspector-section select:focus,
.blue-table-inspector-section textarea:focus {
  border-color: #0b57d0;
  box-shadow: 0 0 0 1px #0b57d0;
}
.blue-table-primary-button,
.blue-table-wide-button,
.blue-table-action-grid button,
.blue-table-segmented button {
  min-height: 34px;
  border: 1px solid #cbd1d8;
  border-radius: 7px;
  background: #fff;
  color: #2c3137;
  cursor: pointer;
}
.blue-table-primary-button {
  padding: 0 13px;
  border-color: #0b57d0;
  background: #0b57d0;
  color: #fff;
}
.blue-table-wide-button { width: 100%; margin-top: 9px; }
.blue-table-primary-button:hover { background: #0848ad; }
.blue-table-wide-button:hover,
.blue-table-action-grid button:hover,
.blue-table-segmented button:hover { border-color: #0b57d0; background: #edf4ff; }
.blue-table-control-label {
  display: block;
  margin: 10px 0 5px;
  color: #59616b;
  font-size: 11px;
}
.blue-table-segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 5px;
}
.blue-table-segmented button.is-active {
  border-color: #0b57d0;
  background: #dce9ff;
  color: #0848ad;
  font-weight: 700;
}
.blue-table-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.blue-table-input-with-unit,
.blue-table-input-with-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}
.blue-table-input-with-unit select { width: 66px; }
.blue-table-input-with-suffix span { color: #68707a; }
.blue-table-range-field { margin-top: 10px; }
.blue-table-range-field > span:last-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}
.blue-table-color-row {
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
}
.blue-table-color-row input[type="color"] {
  box-sizing: border-box;
  width: 100%;
  height: 34px;
  padding: 3px;
  border: 1px solid #cbd1d8;
  border-radius: 7px;
  background: #fff;
}
.blue-table-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  color: #343a40;
  font-size: 12px;
}
.blue-table-switch-row input { width: 36px; height: 20px; accent-color: #0b57d0; }
.blue-table-stacked-field + .blue-table-stacked-field { margin-top: 9px; }
.blue-table-delete-button {
  width: 100%;
  min-height: 38px;
  margin: 0 0 8px;
  border: 1px solid #e1a09b;
  border-radius: 8px;
  background: #fff;
  color: #b3261e;
  cursor: pointer;
}
.blue-table-delete-button:hover { background: #fce8e6; }
.blue-table-inspector-section button:disabled,
.blue-table-inspector-section input:disabled,
.blue-table-inspector-section select:disabled,
.blue-table-delete-button:disabled {
  cursor: default;
  opacity: .48;
}

/* Спільний знімок поточної сторінки RED/BLUE у верхній панелі. */
.blue-format-painter-btn {
  width: 42px;
  min-width: 42px !important;
  padding: 0 !important;
  color: #20334f;
  border-radius: 6px;
}
.blue-format-painter-icon {
  display: block;
  width: 25px;
  height: 25px;
  pointer-events: none;
}
.blue-format-painter-btn.active,
.blue-format-painter-btn[aria-pressed="true"] {
  color: #0b57d0;
  border-color: #a8c7fa;
  background: #e8f0fe;
  box-shadow: inset 0 0 0 1px rgba(11, 87, 208, .08);
}
.blue-format-painter-btn.is-persistent::after {
  content: "∞";
  position: absolute;
  right: 2px;
  bottom: 1px;
  color: currentColor;
  font: 700 9px/1 Arial, sans-serif;
}
.blue-format-painter-btn { position: relative; }

/* Supplied brush becomes the editing cursor while the one-shot formatting
   clipboard is armed. `copy` remains the standards-compatible fallback. */
.editor-shell.blue-format-painter-armed .ooxml-surface,
.editor-shell.blue-format-painter-armed .ooxml-surface * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 16 16'%3E%3Cpath d='M9.44444 4.44444L12.3917 .760432C12.7762 .279794 13.3583 0 13.9738 0C15.0929 0 16 .907148 16 2.02617C16 2.64169 15.7202 3.22383 15.2396 3.60835L11.5556 6.55556L12.2454 7.24538C12.7286 7.72855 13 8.38388 13 9.0672C13 9.66992 12.7887 10.2536 12.4028 10.7166L11.8246 11.4104L4.58957 4.17536L5.2834 3.59717C5.74643 3.21131 6.33008 3 6.9328 3C7.61612 3 8.27145 3.27145 8.75462 3.75462L9.44444 4.44444Z' fill='%231267b0' stroke='white' stroke-width='.55'/%3E%3Cpath d='M0 8L3.04679 5.46101L10.539 12.9532L8 16L0 8Z' fill='%231267b0' stroke='white' stroke-width='.55'/%3E%3C/svg%3E") 2 29, copy !important;
}

.red-app-page-screenshot-btn {
  width: 42px;
  min-width: 42px !important;
  padding: 0 !important;
  color: #20334f;
}
.red-app-page-screenshot-btn .pdf-page-screenshot-icon {
  width: 25px;
  height: 25px;
}
.red-app-page-screenshot-btn:disabled {
  border-color: transparent;
  background: transparent;
  color: #9aa3af;
  cursor: not-allowed;
  opacity: .55;
}

/* ── RED: PDF layers inspector ─────────────────────────────────────────── */
.red-layers-btn[hidden] { display: none !important; }
.red-layers-btn {
  width: 42px;
  min-width: 42px !important;
  padding: 0 !important;
  color: #20334f;
}
.red-layers-toolbar-icon { display: block; width: 25px; height: 25px; }
.red-layers-btn[aria-pressed="true"] {
  border-color: #a8c7fa;
  background: #e8f0fe;
  color: #0b57d0;
}

.red-layer-inspector-panel[hidden] { display: none !important; }
.red-layer-inspector-panel {
  flex: 0 0 390px;
  min-width: 330px;
  max-width: min(420px, 48vw);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #d7dce2;
  background: #f8f9fb;
  color: #25292e;
  box-shadow: -5px 0 18px rgba(43, 49, 57, 0.08);
}
.red-layer-inspector-header {
  flex: 0 0 49px;
  min-height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid #e1e5ea;
  background: #fff;
}
.red-layer-inspector-header > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.red-layer-inspector-header strong { font-size: 14px; }
.red-layer-inspector-header [data-red-layer-total] { color: #707780; font-size: 11px; }
.red-layer-inspector-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
  cursor: pointer;
  font-size: 17px;
}
.red-layer-inspector-close:hover { background: #eef1f4; color: #202124; }
.red-layer-inspector-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}
.red-layer-section > summary { gap: 7px; }
.red-layer-section > summary span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #edf1f6;
  color: #65707c;
  font-size: 10px;
  text-align: center;
}
.red-layer-list { padding: 0 8px 9px; }
.red-layer-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 32px 32px;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 4px 2px;
  border-top: 1px solid #edf0f3;
}
.red-layer-row:first-child { border-top: 0; }
.red-layer-type-icon {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d5dbe2;
  border-radius: 7px;
  background: #f4f7fb;
  color: #31557f;
  font: 700 13px Arial, sans-serif;
}
.red-layer-row-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.red-layer-row-name {
  overflow: hidden;
  color: #25292e;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.red-layer-row-meta {
  overflow: hidden;
  color: #747c86;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.red-layer-badge {
  padding: 2px 5px;
  border: 1px solid #d6dce4;
  border-radius: 5px;
  color: #68727d;
  font-size: 9px;
  font-weight: 700;
}
.red-layer-icon-button {
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #40536b;
  cursor: pointer;
}
.red-layer-icon-button:hover:not(:disabled) { background: #e9f1ff; color: #0b57d0; }
.red-layer-delete:hover:not(:disabled) { background: #fce8e6; color: #b3261e; }
.red-layer-icon-button:disabled { cursor: default; opacity: .38; }
.red-layer-icon-button svg { display: block; width: 100%; height: 100%; }
.red-layer-eye svg path { fill: none; stroke: currentColor; stroke-width: 1.5; }
.red-layer-eye svg .red-layer-eye-closed-fill { fill: currentColor; stroke: none; }
.red-layer-delete svg path { fill: currentColor; }
.red-layer-row.is-hidden .red-layer-type-icon,
.red-layer-row.is-hidden .red-layer-row-copy { opacity: .48; }
.red-layer-row.is-deleted .red-layer-row-name { text-decoration: line-through; }
.red-layer-empty {
  padding: 10px 5px 7px;
  color: #737b85;
  font-size: 11px;
  line-height: 1.45;
}
.red-layer-explanation,
.red-layer-save-note {
  margin: 0;
  color: #6d7580;
  font-size: 10px;
  line-height: 1.45;
}
.red-layer-explanation { padding: 0 12px 11px; }
.red-layer-save-note {
  padding: 10px 11px;
  border: 1px solid #d8e4f5;
  border-radius: 8px;
  background: #eef5ff;
  color: #365a86;
}
@media (max-width: 900px) {
  .red-layer-inspector-panel { flex-basis: min(360px, 74vw); min-width: min(330px, 74vw); max-width: 74vw; }
}
@media (max-width: 820px) {
  .blue-table-inspector-modal,
  .blue-table-inspector-modal .blue-table-inspector-window { width: min(360px, 94vw); }
  .editor-shell.blue-table-editing #ooxmlEngineHost,
  .editor-shell.blue-table-editing .ruler-bar { padding-right: min(360px, 94vw); }
}
.red-image-size-title-row { min-height: 30px; margin: -4px 0 6px; }
.red-image-size-row { display: flex; align-items: end; gap: 9px; }
.red-image-size-row .red-image-size-grid { flex: 1 1 auto; }
.red-image-size-grid { gap: 10px; }
.red-image-input-with-unit {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 38px;
  overflow: hidden;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #fff;
}
.red-image-input-with-unit:focus-within {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.12);
}
.red-image-input-with-unit input {
  min-width: 0;
  height: 36px;
  border: 0;
  box-shadow: none !important;
}
.red-image-input-with-unit > span {
  flex: 0 0 auto;
  padding-right: 9px;
  color: #5f6368;
  font-size: 11px;
}
.red-image-chain-button {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #fff;
  color: #5f6368;
  cursor: pointer;
}
.red-image-chain-button.is-active { color: #0b57d0; border-color: #a8c7fa; background: #eef4ff; }
.red-image-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: #3c4043;
  font-size: 12px;
}
.red-image-switch {
  position: relative;
  width: 36px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: #b6bbc2;
  cursor: pointer;
}
.red-image-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s ease;
}
.red-image-switch.is-active { background: #1a73e8; }
.red-image-switch.is-active span { left: 19px; }
.red-image-wrap-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.red-image-wrap-option {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4b5056;
  font-size: 9px;
  cursor: pointer;
}
.red-image-wrap-preview {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 4px;
  border: 1px solid #d8dde3;
  border-radius: 5px;
  background: repeating-linear-gradient(to bottom, #8d949c 0 1px, transparent 1px 6px);
}
.red-image-wrap-preview i {
  position: absolute;
  left: 13px;
  top: 10px;
  width: 17px;
  height: 20px;
  border: 1px solid #6e747b;
  background: #d9e8ff;
}
.red-image-wrap-option.is-active .red-image-wrap-preview {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8;
}
.red-image-wrap-option.is-active { color: #0b57d0; font-weight: 600; }
.red-image-crop-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.red-image-crop-grid-four .red-image-field { font-size: 10px; }
.red-image-crop-grid-four .red-image-field input { padding: 0 5px; font-size: 12px; }
.red-image-reset-crop,
.red-image-reset-format {
  width: 100%;
  min-height: 32px;
  margin-top: 9px;
  border: 1px solid #d4d8de;
  border-radius: 6px;
  background: #fff;
  color: #3c4043;
  cursor: pointer;
}
.red-image-rotation-row { display: grid; grid-template-columns: 1fr 42px 42px; align-items: end; gap: 8px; }
.red-image-rotation-row > button {
  width: 42px;
  height: 38px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
}
[data-red-image-alt] {
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 9px;
  border: 1px solid #d1d6dc;
  border-radius: 7px;
  font: 12px/1.45 Arial, sans-serif;
}
.red-image-more-actions { display: grid; gap: 8px; }
.red-image-more-actions .red-image-modal-download { width: 100%; margin: 0; }

.footer {
  min-height: 46px;
  padding: 4px 16px;
  background: rgba(255, 255, 255, 0.98);
}
.document-footer-controls { gap: 8px; }
.document-footer-controls #bluePageIndicator { min-width: 86px; text-align: center; }
.document-footer-controls .blue-footer-meta { min-width: 42px; text-align: center; color: #202124; }
.document-footer-controls .blue-footer-zoom-control {
  position: relative;
  min-width: 92px;
  height: 26px;
  align-items: center;
}
.blue-footer-zoom-control::after {
  content: "⌄";
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-52%);
  color: #5f6368;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}
.blue-footer-zoom-control select {
  width: 100%;
  height: 26px;
  padding: 0 17px 0 5px;
  border: 0;
  border-radius: 6px;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: #202124;
  font: 500 13px Arial, sans-serif;
  text-align: center;
  cursor: pointer;
}
.blue-footer-zoom-control select:hover,
.blue-footer-zoom-control select:focus-visible {
  background: rgba(0,0,0,.08);
}

@media (max-width: 1180px) {
  .toolbar-top .red-app-command-label { display: none; }
  .red-app-document-title { max-width: 190px; }
  .red-image-ribbon-control,
  .red-image-ribbon-button { min-width: 86px; padding: 0 12px; }
  .red-image-ribbon-control-wide { min-width: 145px; }
}

/* Модалка QR: затемнений фон + білий заокруглений квадрат із QR-кодом. */
.red-qr-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 31, 51, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.red-qr-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 360px);
  padding: 26px 26px 18px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.red-qr-modal-code {
  display: flex;
  align-items: center;
  justify-content: center;
}
.red-qr-modal-code svg {
  display: block;
  width: min(78vw, 260px);
  height: auto;
}
.red-qr-modal-uri {
  max-width: 100%;
  font-size: 12px;
  line-height: 1.4;
  color: #52606d;
  text-align: center;
  word-break: break-all;
}
.red-qr-modal-fail { color: #c5221f; font-size: 13px; text-align: center; }
.red-qr-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6b7a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.red-qr-modal-close:hover { background: rgba(13, 31, 51, 0.08); }

.pdf-red-text-item::selection {
  background: rgba(26,115,232,.28);
  color: transparent;
}

.pdf-red-text-item.is-search-match {
  background: rgba(255, 214, 10, .42);
  border-radius: 2px;
}

.pdf-add-text-box {
  position: absolute;
  z-index: 12;
  min-width: 34px;
  min-height: 36px;
  padding: 6px 8px;
  border: 2px solid #8ab4f8;
  background: rgba(255,255,255,.02);
  color: #202124;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.25;
  outline: none;
  cursor: text;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  resize: both;
  overflow: hidden;
}

.pdf-edit-text-mode .pdf-red-text-item {
  pointer-events: auto;
  cursor: text;
}

.pdf-edit-text-mode .pdf-red-text-item:hover,
.pdf-red-text-item.is-pdf-edit-hover,
.pdf-red-text-item.is-pdf-text-editing {
  outline: 2px solid #8ab4f8;
  outline-offset: 1px;
  background: rgba(255,255,255,.04);
}

.pdf-red-text-item.is-pdf-text-editing {
  z-index: 20;
  background: rgba(255,255,255,.92);
  color: #202124;
  caret-color: #202124;
}

.pdf-red-text-item.is-pdf-text-edited {
  z-index: 19;
  color: #202124;
  background: rgba(255,255,255,.92);
  outline: 1px dashed rgba(138,180,248,.85);
  outline-offset: 1px;
}

.pdf-add-text-box.is-finalized {
  border-color: transparent;
  background: transparent;
  resize: none;
  cursor: default;
}

.pdf-add-text-box.is-finalized:focus {
  border-color: transparent;
  box-shadow: none;
}

.pdf-add-text-box:focus {
  border-color: #8ab4f8;
  box-shadow: 0 0 0 1px rgba(138,180,248,.45);
}

.pdf-add-text-box:empty::before {
  content: "";
}

.pdf-add-text-box.is-empty {
  width: 42px;
}

.pdf-thumb-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #fff;
}

/* Контролі сторінок/зуму — ЧАСТИНА нижньої панелі (не накладена чорна «пігулка»):
   прозорий фон, колір як у футера, компактні кнопки. */
.pdf-floating-controls {
  position: static;
  z-index: 1;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  color: #444;
  background: transparent;
}

.pdf-floating-controls[hidden] {
  display: none !important;
}

.pdf-floating-controls button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #444;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.pdf-floating-controls button:hover:not(:disabled) {
  background: rgba(0,0,0,.08);
}

.pdf-floating-controls button:disabled {
  opacity: .35;
  cursor: default;
}

.pdf-floating-divider {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: rgba(0,0,0,.18);
}

#pdfPageIndicator,
#bluePageIndicator {
  min-width: 86px;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.pdf-footer-meta,
.blue-footer-meta {
  display: none;
  color: #5f6368;
  white-space: nowrap;
}

.pdf-viewer-mode .pdf-footer-meta,
.ooxml-engine-mode .blue-footer-meta {
  display: inline-flex;
}

.pdf-recognition-panel {
  flex: 0 0 390px;
  min-width: 320px;
  max-width: 46vw;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid #d8dde6;
  background: #252a31;
  color: #fff;
}

.pdf-recognition-panel[hidden] {
  display: none;
}

.pdf-recognition-header {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.pdf-recognition-header button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(255,255,255,.12);
  cursor: pointer;
}

.pdf-recognition-status {
  flex: 0 0 auto;
  padding: 10px 12px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.35;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.red-ocr-options {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.78);
  font-size: 12px;
}

.red-ocr-options label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.red-ocr-options input {
  accent-color: #5b9df9;
}

.pdf-recognition-output {
  height: 100%;
  min-height: 180px;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  padding: 12px;
  background: #fff;
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.red-ocr-progress {
  flex: 0 0 auto;
  padding: 8px 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.red-ocr-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: #d7dce4;
  font-size: 12px;
}

.red-ocr-progress-meta button,
.red-ocr-actions button,
.red-ocr-tabs button,
.red-ocr-correction-row button {
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
}

.red-ocr-progress-meta button {
  padding: 3px 8px;
  font-size: 11px;
}

.red-ocr-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

.red-ocr-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #8ab4f8;
  transition: width .18s ease;
}

.red-ocr-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.red-ocr-tabs button {
  min-height: 30px;
  font-size: 12px;
}

.red-ocr-tabs button.is-active,
.red-ocr-actions button.is-active {
  border-color: #8ab4f8;
  background: rgba(138,180,248,.22);
}

.red-ocr-panel {
  flex: 1 1 auto;
  min-height: 180px;
  overflow: auto;
  background: #fff;
  color: #111;
}

.red-ocr-panel[hidden] {
  display: none;
}

.red-ocr-structured-output {
  min-height: 100%;
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11px/1.45 "IBM Plex Mono", monospace;
  color: #202124;
}

.red-ocr-training-panel {
  padding: 10px;
}

.red-ocr-training-list {
  display: grid;
  gap: 6px;
}

.red-ocr-training-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #e0e4ea;
  border-radius: 7px;
  background: #f7f9fc;
  font-size: 12px;
}

.red-ocr-training-item small,
.red-ocr-empty {
  color: #6b7280;
}

.red-ocr-metrics {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(255,255,255,.08);
  border-top: 1px solid rgba(255,255,255,.08);
}

.red-ocr-metrics span {
  min-width: 0;
  padding: 7px 5px;
  text-align: center;
  background: #2c323a;
}

.red-ocr-metrics b,
.red-ocr-metrics small {
  display: block;
}

.red-ocr-metrics b {
  font-size: 13px;
}

.red-ocr-metrics small {
  margin-top: 2px;
  color: rgba(255,255,255,.58);
  font-size: 9px;
  line-height: 1.15;
}

.red-ocr-word-inspector {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  background: #20252c;
  font-size: 12px;
}

.red-ocr-word-heading,
.red-ocr-correction-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.red-ocr-word-heading {
  justify-content: space-between;
  margin-bottom: 7px;
}

.red-ocr-word-inspector img {
  max-width: 100%;
  max-height: 72px;
  margin-bottom: 7px;
  border-radius: 4px;
  background: #fff;
  image-rendering: pixelated;
}

.red-ocr-word-alternatives {
  margin-bottom: 8px;
  color: rgba(255,255,255,.68);
  overflow-wrap: anywhere;
}

.red-ocr-word-inspector label {
  display: block;
  margin-bottom: 4px;
  color: rgba(255,255,255,.68);
}

.red-ocr-correction-row input {
  min-width: 0;
  flex: 1;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #69717d;
  border-radius: 6px;
  outline: none;
}

.red-ocr-correction-row button {
  height: 30px;
  padding: 0 10px;
}

#pdfOCRCorrectionMessage {
  display: block;
  min-height: 14px;
  margin-top: 5px;
  color: #9bd3a7;
}

.red-ocr-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.red-ocr-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.red-quick-ocr-modal-actions {
  box-sizing: border-box;
  display: block;
  min-height: 28px;
  padding: 4px 10px;
}

.red-quick-ocr-modal-actions button {
  min-height: 34px;
  font-size: 12px;
  font-weight: 600;
}

.red-quick-ocr-modal-actions button.is-complete {
  border-color: #22c55e;
  background: rgba(34, 197, 94, .28);
  color: #ecfdf5;
}

.red-quick-ocr-modal-actions button.is-running {
  border-color: #facc15;
  background: rgba(250, 204, 21, .22);
  color: #fff;
}

.red-quick-ocr-modal-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.red-ocr-debug-overlay,
.red-ocr-searchable-layer {
  position: absolute;
  inset: 0;
}

.red-ocr-debug-overlay {
  z-index: 11;
  pointer-events: none;
}

.red-ocr-box {
  position: absolute;
  min-width: 2px;
  min-height: 2px;
  padding: 0;
  border-radius: 2px;
  background: transparent;
  pointer-events: none;
}

.red-ocr-box.is-block {
  border: 1px solid rgba(76,175,80,.78);
}

.red-ocr-box.is-line {
  border: 1px solid rgba(33,150,243,.55);
}

.red-ocr-box.is-word {
  z-index: 2;
  border: 1px solid rgba(255,193,7,.72);
  pointer-events: auto;
  cursor: pointer;
}

.red-ocr-box.is-glyph {
  z-index: 3;
  border: 1px solid rgba(156,39,176,.85);
  pointer-events: auto;
  cursor: help;
}

.red-ocr-box.is-glyph.is-low-confidence {
  border: 2px solid rgba(244,67,54,.95);
}

.red-ocr-box.is-low-confidence {
  border: 2px solid rgba(244,67,54,.9);
  background: rgba(244,67,54,.08);
}

.red-ocr-searchable-layer {
  z-index: 12;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.01);
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.red-ocr-searchable-layer span {
  position: absolute;
  display: block;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.01);
  white-space: nowrap;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  transform-origin: 0 0;
}

.ooxml-paragraph-marker {
  cursor: pointer;
  border-radius: 6px;
  transition: background-color .12s ease, box-shadow .12s ease;
}

.ooxml-paragraph-marker:hover {
  background: rgba(26,115,232,0.08);
  box-shadow: inset 0 0 0 1px rgba(26,115,232,0.18);
}

.ooxml-list-number-menu[hidden] {
  display: none;
}

.ooxml-list-number-menu {
  position: fixed;
  min-width: 220px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(60,64,67,.28);
  padding: 8px;
  z-index: 50010;
}

.ooxml-list-number-menu-btn {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: #fff;
  border-radius: 8px;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
  color: #202124;
  font-size: 14px;
}

.ooxml-list-number-menu-btn:hover {
  background: #f1f3f4;
}

.ooxml-list-number-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 0;
}

.ooxml-list-marker {
  direction: ltr;
  unicode-bidi: isolate;
  line-height: inherit;
}

.ooxml-bound-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.ooxml-bound-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ooxml-bound-copy-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
}

.ooxml-bound-copy-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.ooxml-bound-copy-icon-btn svg path {
  stroke: #1f2328;
}

.ooxml-bound-copy-icon-btn:hover svg path {
  stroke: #111111;
}

.ooxml-bound-copy-icon-btn:focus {
  outline: none;
}

.ooxml-bound-tab {
  padding: 0 12px;
  height: 28px;
  min-height: 28px;
}

    .footer {
      position: relative;
      z-index: 24000;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      gap: 10px;
      min-height: 40px;
      padding: 4px 12px;
      border-top: 1px solid #d7d7d7;
      background: #f6f6f6;
      font-size: 13px;
      color: #555;
      flex: 0 0 auto;
      overflow: hidden;
    }

    /* Бічні колонки можуть стискатися й КЛІПУВАТИ вміст; footer-overflow.js
       згортає елементи у випадайку (⋯), щоб центральний блок не наїжджав. */
    .footer-status-left,
    .footer-status-right {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
    }

    .footer-status-right {
      justify-content: flex-end;
    }

    .footer-item { flex: 0 0 auto; }

    /* Кнопка ⋯ і випадайка зі згорнутими елементами футера. */
    .footer-more-btn {
      flex: 0 0 auto;
      width: 26px;
      height: 22px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: #555;
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
    }
    .footer-more-btn:hover { background: rgba(0,0,0,.08); }
    .footer-more-btn[hidden] { display: none; }

    .footer-more-menu {
      position: fixed;
      z-index: 2147483200;
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-width: 140px;
      max-width: 80vw;
      padding: 8px 10px;
      border-radius: 10px;
      background: #ffffff;
      box-shadow: 0 6px 22px rgba(13,31,51,.22), 0 0 0 1px rgba(13,31,51,.08);
      font-size: 13px;
      color: #444;
      white-space: normal;
    }
    .footer-more-menu[hidden] { display: none; }
    /* Згорнуті елементи у меню — кожен у своєму рядку. Підпис додаємо лише тим,
       чий власний текст його не містить (зум: «100%» → «Масштаб: 100%»). */
    .footer-more-menu .footer-item { display: block; }
    .footer-more-menu .footer-item[data-needs-label]::before {
      content: attr(data-footer-label) ": ";
      color: #8a94a6;
    }

    .danger {
      color: #9f1f14;
    }

    .format-transfer-group {
      gap: 4px !important;
    }

    .copy-format-btn,
    .remove-format-btn {
      width: 30px;
      min-width: 30px;
      padding: 0;
    }

    .copy-format-icon,
    .remove-format-icon {
      width: 18px;
      height: 18px;
      display: block;
      color: currentColor;
      fill: currentColor;
      pointer-events: none;
      flex: 0 0 auto;
    }

    .copy-format-btn {
      color: #3c4043;
    }

    .copy-format-btn:hover {
      color: #202124;
    }

    .copy-format-btn.active {
      color: #174ea6;
    }

    .font-modal-overlay[hidden] {
      display: none;
    }

    .font-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(60, 64, 67, 0.32);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 20000;
      padding: 24px;
    }

    .font-modal-header {
      padding: 28px 28px 12px;
    }

    .font-modal-title {
      font-size: 22px;
      line-height: 1.2;
      color: #202124;
      font-weight: 400;
    }

    .font-modal-toolbar {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 14px;
      padding: 0 28px 18px;
      flex-wrap: nowrap;
    }

    .font-modal-search {
      position: relative;
      width: 236px;
      flex: 0 0 236px;
    }

    .font-modal-search input {
      width: 100%;
      height: 44px;
      border: 1px solid #9aa0a6;
      border-radius: 999px;
      background: #f8f9fa;
      padding: 0 42px 0 44px;
      font-size: 16px;
      color: #202124;
      outline: none;
    }

    .font-modal-search input:focus {
      background: #fff;
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .font-modal-search-icon {
      position: absolute;
      left: 15px;
      top: 50%;
      transform: translateY(-50%);
      color: #5f6368;
      font-size: 18px;
      pointer-events: none;
    }

    .font-modal-search-clear {
      position: absolute;
      right: 12px;
      top: 50%;
      transform: translateY(-50%);
      width: 26px;
      height: 26px;
      border: 0;
      background: transparent;
      border-radius: 50%;
      cursor: pointer;
      color: #5f6368;
      font-size: 16px;
    }

    .font-modal-search-clear:hover {
      background: #e8eaed;
    }

    .font-modal-filters {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      flex-wrap: nowrap;
    }

    .font-modal-select-wrap {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .font-modal-select-label {
      font-size: 12px;
      color: #5f6368;
      padding-left: 10px;
    }

    .font-modal-select {
      min-width: 124px;
      height: 44px;
      border: 1px solid #9aa0a6;
      border-radius: 8px;
      background: #fff;
      color: #202124;
      font-size: 15px;
      padding: 0 34px 0 14px;
      appearance: none;
      background-image:
        linear-gradient(45deg, transparent 50%, #5f6368 50%),
        linear-gradient(135deg, #5f6368 50%, transparent 50%);
      background-position:
        calc(100% - 17px) 19px,
        calc(100% - 11px) 19px;
      background-size: 6px 6px, 6px 6px;
      background-repeat: no-repeat;
    }

    .font-modal-select:focus {
      outline: none;
      border-color: #1a73e8;
      box-shadow: 0 0 0 1px #1a73e8;
    }

    .font-modal-body {
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 184px;
      gap: 16px;
      padding: 0 28px;
    }

    .font-modal-list-wrap,
    .font-modal-selected-wrap {
      min-height: 0;
    }

    .font-modal-list,
    .font-modal-selected-list {
      height: 100%;
      overflow: auto;
      background: #fff;
      border-radius: 12px;
      scrollbar-gutter: stable;
    }

    .font-modal-row,
    .font-modal-selected-row {
      display: flex;
      align-items: center;
      gap: 14px;
      min-height: 46px;
      padding: 0 16px;
      border-bottom: 1px solid #eceff1;
      background: #fff;
    }

    .font-modal-row:last-child,
    .font-modal-selected-row:last-child {
      border-bottom: 0;
    }

    .font-modal-row:hover,
    .font-modal-selected-row:hover {
      background: #f8f9fa;
    }

    .font-modal-row {
      width: 100%;
      border-top: 0;
      border-left: 0;
      border-right: 0;
      text-align: left;
      cursor: pointer;
    }

    .font-modal-row.selected {
      background: #fff;
      box-shadow: inset 0 0 0 2px #1a73e8;
      border-radius: 10px;
      border-bottom-color: transparent;
      margin: 1px 0;
    }

    .font-modal-checkbox {
      width: 20px;
      height: 20px;
      border: 2px solid #5f6368;
      border-radius: 2px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      color: #fff;
      flex: 0 0 20px;
    }

    .font-modal-row.selected .font-modal-checkbox {
      background: #1a73e8;
      border-color: #1a73e8;
    }

    .font-modal-font-name {
      flex: 1 1 auto;
      min-width: 0;
      font-size: 15px;
      color: #202124;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .font-modal-selected-title {
      font-size: 14px;
      font-weight: 600;
      color: #202124;
      margin-bottom: 8px;
      padding-top: 2px;
    }

    .font-modal-remove-btn {
      width: 24px;
      height: 24px;
      border: 0;
      background: transparent;
      border-radius: 50%;
      cursor: pointer;
      color: #5f6368;
      font-size: 18px;
      flex: 0 0 24px;
    }

    .font-modal-remove-btn:hover {
      background: #f1f3f4;
      color: #202124;
    }

    .font-modal-empty {
      padding: 16px;
      color: #5f6368;
      font-size: 14px;
    }

    .font-modal-footer {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 14px;
      padding: 18px 28px 20px;
    }

    .font-modal-btn-reset {
      margin-right: auto;
    }

    .font-modal-btn {
      min-width: 104px;
      height: 40px;
      border-radius: 999px;
      font-size: 15px;
      font-weight: 500;
      border: 1px solid transparent;
      cursor: pointer;
    }

    .font-modal-btn-secondary {
      background: transparent;
      color: #1a73e8;
    }

    .font-modal-btn-secondary:hover {
      background: rgba(26, 115, 232, .08);
    }

    .font-modal-btn-primary {
      background: #1a73e8;
      color: #fff;
    }

    .font-modal-btn-primary:hover {
      background: #1765cc;
    }

    .font-modal-row,
    .font-modal-remove-btn,
    .font-modal-btn,
    .font-modal-search-clear {
      appearance: none;
      -webkit-appearance: none;
      font-family: Arial, sans-serif;
    }

    .toolbar-top {
      justify-content: space-between;
    }

    .toolbar-settings-group {
      margin-left: auto;
      padding-right: 10px;
    }

.toolbar-settings-btn {
  width: 30px;
  min-width: 30px;
  padding: 0;
  color: #5f6368;
}

.toolbar-settings-btn:hover {
  color: #202124;
}

.toolbar-settings-icon {
  width: 18px;
  height: 18px;
  display: block;
  color: currentColor;
  fill: currentColor;
  pointer-events: none;
  flex: 0 0 auto;
}

    /* ===== Modal: toolbar buttons ===== */

    .toolbar-buttons-modal-overlay[hidden] {
      display: none;
    }

    .toolbar-buttons-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(60, 64, 67, 0.32);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 21000;
      padding: 24px;
    }

    .toolbar-buttons-modal-header {
      padding: 28px 28px 12px;
    }

    .toolbar-buttons-modal-title {
      font-size: 22px;
      line-height: 1.2;
      color: #202124;
      font-weight: 400;
    }

    .toolbar-buttons-modal-body {
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 220px;
      gap: 16px;
      padding: 0 28px 12px;
    }

    .toolbar-buttons-modal-list-wrap,
    .toolbar-buttons-modal-selected-wrap {
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .toolbar-buttons-modal-list,
    .toolbar-buttons-modal-selected-list {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      background: #fff;
      border-radius: 12px;
      scrollbar-gutter: stable both-edges;
    }

    .toolbar-buttons-modal-selected-title {
      font-size: 14px;
      font-weight: 600;
      color: #202124;
      margin-bottom: 8px;
      padding-top: 2px;
      flex: 0 0 auto;
    }

    .toolbar-buttons-modal-footer {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 28px 20px;
      flex: 0 0 auto;
    }

    .toolbar-buttons-modal-btn-reset {
      margin-right: auto;
    }

    .toolbar-buttons-row,
    .toolbar-buttons-selected-row {
      display: flex;
      align-items: center;
      gap: 14px;
      min-height: 46px;
      padding: 0 16px;
      border-bottom: 1px solid #eceff1;
      background: #fff;
      flex: 0 0 auto;
    }

    .toolbar-buttons-row:last-child,
    .toolbar-buttons-selected-row:last-child {
      border-bottom: 0;
    }

    .toolbar-buttons-row {
      width: 100%;
      border: 0;
      text-align: left;
      cursor: pointer;
    }

    .toolbar-buttons-row:hover,
    .toolbar-buttons-selected-row:hover {
      background: #f8f9fa;
    }

    .toolbar-buttons-row.selected {
      background: #fff;
      box-shadow: inset 0 0 0 2px #1a73e8;
      border-radius: 10px;
      border-bottom-color: transparent;
      margin: 1px 0;
    }

    .toolbar-buttons-checkbox {
      width: 20px;
      height: 20px;
      border: 2px solid #5f6368;
      border-radius: 2px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      color: #fff;
      flex: 0 0 20px;
    }

    .toolbar-buttons-row.selected .toolbar-buttons-checkbox {
      background: #1a73e8;
      border-color: #1a73e8;
    }

    .toolbar-buttons-icon {
      width: 28px;
      flex: 0 0 28px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      color: #202124;
    }

    .toolbar-buttons-name {
      flex: 1 1 auto;
      min-width: 0;
      font-size: 15px;
      color: #202124;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .toolbar-buttons-remove-btn {
      width: 24px;
      height: 24px;
      border: 0;
      background: transparent;
      border-radius: 50%;
      cursor: pointer;
      color: #5f6368;
      font-size: 18px;
      flex: 0 0 24px;
    }

    .toolbar-buttons-remove-btn:hover {
      background: #f1f3f4;
      color: #202124;
    }

    .toolbar-buttons-empty {
      padding: 16px;
      color: #5f6368;
      font-size: 14px;
    }

    .toolbar-buttons-modal-btn {
      min-width: 104px;
      height: 40px;
      border-radius: 999px;
      font-size: 15px;
      font-weight: 500;
      border: 1px solid transparent;
      cursor: pointer;
    }

    .toolbar-buttons-modal-btn-secondary {
      background: transparent;
      color: #1a73e8;
    }

    .toolbar-buttons-modal-btn-secondary:hover {
      background: rgba(26, 115, 232, .08);
    }

    .toolbar-buttons-modal-btn-primary {
      background: #1a73e8;
      color: #fff;
    }

    .toolbar-buttons-modal-btn-primary:hover {
      background: #1765cc;
    }

.ruler-track {
  position: relative;
  height: 20px;
  margin: 0;
  width: 100%;
  overflow: visible;
}

.list-style-dropdown {
  position: relative;
}

.list-style-trigger {
  min-width: 62px;
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c6c6c6;
}

.list-style-trigger:hover {
  background: #fff;
  border-color: #9aa0a6;
}

.list-style-dropdown.open .list-style-trigger {
  background: #f1f3f4;
}

.list-style-trigger-icon {
  width: 22px;
  height: 22px;
  color: #3c4043;
  fill: currentColor;
  pointer-events: none;
  flex: 0 0 auto;
}

.list-style-trigger-arrow {
  font-size: 10px;
  color: #202124;
  pointer-events: none;
}




.list-style-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 460px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(60,64,67,.24);
  padding: 8px;
  z-index: 8000;
}

.list-style-dropdown.open .list-style-panel {
  display: block;
}

.list-style-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 7px;
}

.list-style-card {
  min-height: 98px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 2px;
  cursor: pointer;
  padding: 6px 5px;
  text-align: left;
  color: #202124;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-style-card:hover {
  border-color: #aecbfa;
  background: #f8fbff;
}

.list-style-card.active {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8 inset;
}

.list-style-card-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 11px;
}

.list-style-card-line.level-1 {
  padding-left: 0;
}

.list-style-card-line.level-2 {
  padding-left: 9px;
}

.list-style-card-line.level-3 {
  padding-left: 18px;
}

.list-style-card-line.level-4 {
  padding-left: 27px;
}

.list-style-card-marker {
  flex: 0 0 auto;
  min-width: 15px;
  font-size: 12px;
  line-height: 1;
  color: #202124;
}

.list-style-card-line.level-3 .list-style-card-marker,
.list-style-card-line.level-4 .list-style-card-marker {
  min-width: 17px;
}

.list-style-card-text {
  flex: 1 1 auto;
  height: 3px;
  background: #d9d9d9;
  border-radius: 1px;
}

.list-style-card-text.short {
  max-width: 21px;
}

.list-style-card-text.medium {
  max-width: 29px;
}

.list-style-card-text.long {
  max-width: 38px;
}

.line-spacing-dropdown {
  position: relative;
}

.line-spacing-trigger {
  min-width: 62px;
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c6c6c6;
}

.line-spacing-trigger:hover {
  background: #fff;
  border-color: #9aa0a6;
}

.line-spacing-dropdown.open .line-spacing-trigger,
.line-spacing-trigger:active {
  background: #f1f3f4;
  border-color: #c6c6c6;
}

.line-spacing-trigger-icon {
  width: 22px;
  height: 22px;
  display: block;
  color: #3c4043;
  fill: currentColor;
  pointer-events: none;
  flex: 0 0 auto;
}

.line-spacing-trigger:hover .line-spacing-trigger-icon {
  color: #202124;
}

.line-spacing-trigger.active .line-spacing-trigger-icon,
.line-spacing-dropdown.open .line-spacing-trigger .line-spacing-trigger-icon {
  color: #3c4043;
}

.line-spacing-trigger-arrow {
  font-size: 10px;
  color: #202124;
  flex: 0 0 auto;
  pointer-events: none;
}

.line-spacing-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(60, 64, 67, .28);
  z-index: 5000;
  overflow: hidden;
  padding: 8px 0;
}

.line-spacing-dropdown.open .line-spacing-menu {
  display: block;
}

.line-spacing-menu-item {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  text-align: left;
  cursor: pointer;
  color: #202124;
  font-size: 14px;
}

.line-spacing-menu-item:hover,
.line-spacing-menu-item.active {
  background: #f1f3f4;
}

.line-spacing-menu-check {
  width: 18px;
  flex: 0 0 18px;
  color: #5f6368;
  font-size: 15px;
}

.line-spacing-menu-item:not(.active) .line-spacing-menu-check {
  visibility: hidden;
}

.line-spacing-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 0;
}

.line-spacing-custom-overlay[hidden] {
  display: none;
}

.line-spacing-custom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 64, 67, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 22000;
  padding: 24px;
}

.line-spacing-custom-title {
  font-size: 18px;
  line-height: 1.2;
  color: #202124;
  margin-bottom: 18px;
}

.line-spacing-field-group {
  margin-bottom: 22px;
}

.line-spacing-field-label {
  display: block;
  font-size: 13px;
  color: #1a73e8;
  margin-bottom: 8px;
}

.line-spacing-field-input,
.line-spacing-points-input {
  width: 100%;
  height: 56px;
  border: 1px solid #9aa0a6;
  border-radius: 4px;
  background: #fff;
  padding: 0 14px;
  font-size: 18px;
  color: #202124;
  outline: none;
}

.line-spacing-field-input:focus,
.line-spacing-points-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8;
}

.line-spacing-points-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.line-spacing-points-wrap {
  position: relative;
}

.line-spacing-points-wrap label {
  position: absolute;
  top: -8px;
  left: 12px;
  padding: 0 4px;
  font-size: 12px;
  color: #5f6368;
  background: #fff;
}

.line-spacing-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.line-spacing-modal-btn {
  min-width: 138px;
  height: 40px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
}

.line-spacing-modal-btn-secondary {
  background: transparent;
  color: #1a73e8;
}

.line-spacing-modal-btn-secondary:hover {
  background: rgba(26, 115, 232, .08);
}

.line-spacing-modal-btn-primary {
  background: #1a73e8;
  color: #fff;
}

.line-spacing-modal-btn-primary:hover {
  background: #1765cc;
}

:root {
  --app-modal-width: min(760px, calc(100vw - 48px));
  --app-modal-height: min(560px, calc(100vh - 48px));
  --app-modal-radius: 28px;
  --app-modal-shadow: 0 12px 32px rgba(60, 64, 67, 0.3);
  --app-modal-bg: #f1f4f9;
}

.font-modal,
.toolbar-buttons-modal,
.recent-docs-modal,
.line-spacing-custom-modal {
  width: var(--app-modal-width);
  height: var(--app-modal-height);
  background: var(--app-modal-bg);
  border-radius: var(--app-modal-radius);
  box-shadow: var(--app-modal-shadow);
}

.font-modal,
.toolbar-buttons-modal,
.recent-docs-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.line-spacing-custom-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 28px 24px;
}

.recent-docs-modal {
  background: #f1f4f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ooxml-text-format-window {
}

:root {
  --side-modal-width: 360px;
  --side-modal-height: 292px;
}

.ooxml-text-format-window {
  width: var(--side-modal-width);
  height: var(--side-modal-height);
}

.ooxml-side-modal-window.ooxml-references-window {
  width: var(--side-modal-width);
  height: min(500px, calc(100vh - var(--side-modal-top) - 16px));
}

.ooxml-side-modal-window.ooxml-header-footer-window {
  width: var(--side-modal-width);
  height: min(690px, calc(100vh - var(--side-modal-top) - 16px));
}

/* Панель «Таблиця» довша за фіксовану висоту вікна: сітка 8×8, сім дій над
   структурою і три режими рамок. Вікно росте під вміст (у межах екрана), щоб
   кнопки не ховалися нижче краю. */
.ooxml-text-format-window[data-panel="table"] {
  height: 560px;
}

.ooxml-text-format-window[data-panel="styles"][data-underline-expanded] {
  height: min(560px, calc(100vh - var(--side-modal-top) - 16px));
}

/* На низьких екранах вікно не має вилазити за край — решта панелі
   догортується всередині тіла модалки. */
@media (max-height: 700px) {
  .ooxml-text-format-window[data-panel="table"] { height: 440px; }
}

.line-spacing-custom-modal {
  background: #f1f4f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 28px 28px 24px;
}

.ruler-toggle-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: #5f6368;
}

.ruler-toggle-btn:hover {
  color: #202124;
}

.ruler-toggle-btn.active {
  color: #174ea6;
  background: #e8f0fe;
  border-color: #aecbfa;
  box-shadow: none;
}

.ruler-toggle-icon {
  width: 21px;
  height: 21px;
  display: block;
  color: currentColor;
  pointer-events: none;
  flex: 0 0 auto;
}

.ruler-bar[hidden] {
  display: none;
}

.ruler-bar {
  position: relative;
  height: 25px;
  min-height: 25px;
  flex: 0 0 25px;
  border-top: 1px solid #f1f3f4;
  border-bottom: 1px solid #c9cdd3;
  background: linear-gradient(#fafbfc, #f1f3f4);
  overflow: visible;
  z-index: 40;
}

.ruler-track {
  position: relative;
  height: 24px;
  margin: 0;
  width: 100%;
  overflow: hidden;
  cursor: default;
}

.ruler-page-band {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 1px;
  background: rgba(255, 255, 255, .88);
  border-left: 1px solid #c3c7cd;
  border-right: 1px solid #c3c7cd;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .12);
  pointer-events: none;
  z-index: 1;
}

.ruler-scale {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.ruler-cm-mark {
  position: absolute;
  top: 13px;
  width: 1px;
  height: 8px;
  background: #747980;
}

.ruler-cm-mark::before {
  content: attr(data-label);
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  line-height: 1;
  color: #5f6368;
}

.ruler-half-mark {
  position: absolute;
  top: 16px;
  width: 1px;
  height: 5px;
  background: #9aa0a6;
}

.ruler-handle {
  position: absolute;
  top: 0;
  width: 12px;
  height: 8px;
  margin-left: -6px;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: ew-resize;
  z-index: 6;
  touch-action: none;
}

.ruler-handle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #4285f4;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 50% 100%, 0 45%);
}

.ruler-handle.left,
.ruler-handle.right {
  top: 16px;
}

.ruler-handle.left::after,
.ruler-handle.right::after {
  clip-path: polygon(50% 0, 100% 55%, 100% 100%, 0 100%, 0 55%);
}

.ruler-handle:hover::after,
.ruler-handle:focus-visible::after {
  background: #1a73e8;
}

.ruler-handle:focus-visible {
  outline: 2px solid #174ea6;
  outline-offset: 2px;
}

.ruler-handle-label {
  display: none;
}

.ruler-handle::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 13px;
  background: #4285f4;
  clip-path: none;
}

.ruler-handle.left::before,
.ruler-handle.right::before {
  top: -8px;
  height: 9px;
}

.ruler-margin-fill-left,
.ruler-margin-fill-right {
  position: absolute;
  top: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(135deg, rgba(95, 99, 104, .07) 0 2px, transparent 2px 5px),
    rgba(95, 99, 104, .12);
  border-left: 1px solid rgba(95, 99, 104, .15);
  border-right: 1px solid rgba(95, 99, 104, .15);
  pointer-events: none;
  z-index: 2;
}

.ruler-bar.mixed-indents .ruler-handle::after {
  background: #7b61c9;
}

.ruler-track.dragging-indent {
  cursor: ew-resize;
}

.table-picker-dropdown {
  position: relative;
}

.table-picker-trigger {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  color: #5f6368;
}

.table-picker-trigger:hover {
  color: #202124;
}

.table-picker-trigger.active,
.table-picker-dropdown.open .table-picker-trigger {
  color: #174ea6;
  background: #e8f0fe;
  border-color: #aecbfa;
  box-shadow: none;
}

.table-picker-icon {
  width: 18px;
  height: 18px;
  display: block;
  color: currentColor;
  fill: currentColor;
  pointer-events: none;
  flex: 0 0 auto;
}

.table-picker-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  max-width: none;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(60, 64, 67, .28);
  padding: 8px 8px 12px;
  z-index: 7000;
}

.table-picker-dropdown.open .table-picker-panel {
  display: block;
}

.table-picker-grid {
  display: grid;
  grid-template-columns: repeat(var(--table-picker-cols, 11), 14px);
  grid-auto-rows: 14px;
  gap: 3px;
  justify-content: start;
  align-content: start;
  min-height: auto;
}

.table-picker-panel.grow-left .table-picker-grid {
  justify-content: end;
}

.table-picker-cell {
  width: 14px;
  height: 14px;
  border: 1px solid #e6e6e6;
  border-radius: 2px;
  background: #fafafa;
}

.table-picker-cell.is-active {
  border-color: #6ea1f2;
  background: #dbe7fb;
}

.table-picker-size {
  text-align: center;
  font-size: 14px;
  line-height: 1.2;
  color: #202124;
  margin-top: 8px;
  font-weight: 500;
}

.table-picker-dropdown.open .table-picker-trigger {
  color: #174ea6;
}

.file-toggle {
  min-width: 72px;
  justify-content: space-between;
  gap: 8px;
}

.file-dropdown-menu {
  min-width: 220px;
}

.recent-docs-modal-overlay[hidden] {
  display: none;
}

.recent-docs-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(60, 64, 67, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 26000;
  padding: 24px;
}

/* BLUE Office Math ---------------------------------------------------------
   Native OMML (§22.1) is laid out as semantic DOM instead of rasterising the
   equation. Cambria Math is preferred when installed; STIX/serif are safe
   offline fallbacks. */
.ooxml-math-zone {
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  margin: 0 0.08em;
  padding: 0.06em 0.1em;
  border-radius: 4px;
  color: inherit;
  font-family: "Cambria Math", "STIX Two Math", "STIXGeneral", "Times New Roman", serif;
  line-height: 1.15;
  vertical-align: middle;
  white-space: nowrap;
  cursor: default;
  user-select: text;
}

.blue-math-modal-btn-toolbar[hidden] { display: none !important; }
.blue-math-toolbar-symbol {
  display: inline-block;
  min-width: 24px;
  font: 700 25px/1 "Cambria Math", "Times New Roman", serif;
}

.ooxml-math-zone[data-display="true"] {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  margin: 0.25em 0;
  padding: 0.18em 0.35em;
  justify-content: center;
  font-size: 1.08em;
}

.ooxml-math-zone[data-justification="left"] { justify-content: flex-start; }
.ooxml-math-zone[data-justification="right"] { justify-content: flex-end; }
.ooxml-math-zone:focus {
  outline: 2px solid rgba(26, 115, 232, 0.7);
  outline-offset: 2px;
  background: rgba(232, 240, 254, 0.55);
}

.ooxml-math-fraction {
  display: inline-grid;
  grid-template-rows: auto auto;
  justify-items: stretch;
  align-items: center;
  text-align: center;
  vertical-align: middle;
  margin: 0 0.12em;
}

.ooxml-math-numerator,
.ooxml-math-denominator {
  display: block;
  min-width: 0.8em;
  padding: 0 0.13em;
}

.ooxml-math-denominator { border-top: 0.065em solid currentColor; }
.ooxml-math-fraction[data-fraction-type="noBar"] .ooxml-math-denominator { border-top: 0; }
.ooxml-math-fraction[data-fraction-type="skw"],
.ooxml-math-fraction[data-fraction-type="lin"] {
  display: inline-flex;
  gap: 0.12em;
}
.ooxml-math-fraction[data-fraction-type="skw"] .ooxml-math-denominator,
.ooxml-math-fraction[data-fraction-type="lin"] .ooxml-math-denominator { border-top: 0; }
.ooxml-math-fraction[data-fraction-type="skw"] .ooxml-math-numerator::after,
.ooxml-math-fraction[data-fraction-type="lin"] .ooxml-math-numerator::after { content: "/"; margin-left: 0.12em; }

.ooxml-math-radical {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto;
  align-items: end;
  margin: 0 0.08em;
}
.ooxml-math-degree { grid-column: 1; grid-row: 1; font-size: 0.58em; align-self: end; }
.ooxml-math-radical-sign { grid-column: 2; grid-row: 1 / span 2; font-size: 1.55em; line-height: 0.9; }
.ooxml-math-radicand {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: stretch;
  border-top: 0.065em solid currentColor;
  padding: 0.06em 0.12em 0 0.08em;
}

.ooxml-math-script {
  display: inline-grid;
  grid-template-columns: auto auto;
  grid-template-rows: 0.78em 0.78em;
  align-items: center;
  vertical-align: middle;
}
.ooxml-math-script-base { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.ooxml-math-sub { grid-column: 2; grid-row: 2; font-size: 0.7em; align-self: start; }
.ooxml-math-sup { grid-column: 2; grid-row: 1; font-size: 0.7em; align-self: end; }
.ooxml-math-script[data-script-type="sPre"] .ooxml-math-script-base { grid-column: 2; }
.ooxml-math-script[data-script-type="sPre"] .ooxml-math-sub,
.ooxml-math-script[data-script-type="sPre"] .ooxml-math-sup { grid-column: 1; }

.ooxml-math-nary {
  display: inline-grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  justify-items: center;
  margin: 0 0.12em;
}
.ooxml-math-nary-symbol { grid-column: 1; grid-row: 2; font-size: 1.65em; line-height: 0.8; }
.ooxml-math-nary-sup { grid-column: 1; grid-row: 1; font-size: 0.65em; }
.ooxml-math-nary-sub { grid-column: 1; grid-row: 3; font-size: 0.65em; }
.ooxml-math-nary-body { grid-column: 2; grid-row: 1 / span 3; margin-left: 0.18em; }

.ooxml-math-delimiter { display: inline-flex; align-items: stretch; }
.ooxml-math-delimiter-char {
  display: inline-flex;
  align-items: center;
  font-size: 1.38em;
  line-height: 1;
}
.ooxml-math-delimiter-body { display: inline-flex; align-items: center; padding: 0 0.05em; }

.ooxml-math-function { display: inline-flex; align-items: center; gap: 0.2em; }
.ooxml-math-function-name { font-style: normal; }
.ooxml-math-function-body { font-style: italic; }

.ooxml-math-accent,
.ooxml-math-limit {
  display: inline-grid;
  grid-template-rows: auto auto;
  justify-items: center;
  align-items: center;
}
.ooxml-math-accent-mark,
.ooxml-math-limit-value { grid-row: 1; font-size: 0.72em; line-height: 0.75; }
.ooxml-math-accent-body,
.ooxml-math-limit-body { grid-row: 2; }
.ooxml-math-accent[data-position="bottom"] .ooxml-math-accent-body,
.ooxml-math-limit[data-position="bottom"] .ooxml-math-limit-body { grid-row: 1; }
.ooxml-math-accent[data-position="bottom"] .ooxml-math-accent-mark,
.ooxml-math-limit[data-position="bottom"] .ooxml-math-limit-value { grid-row: 2; }

.ooxml-math-matrix {
  display: inline-grid;
  grid-template-columns: repeat(var(--ooxml-math-columns, 1), auto);
  align-items: center;
  gap: 0.22em 0.65em;
  padding: 0.08em 0.18em;
}
.ooxml-math-matrix-cell { display: inline-flex; justify-content: center; min-width: 0.7em; }
.ooxml-math-equation-array { display: inline-flex; flex-direction: column; align-items: stretch; gap: 0.12em; }
.ooxml-math-equation-row { display: block; }

/* Equation creation dialog. */
.blue-math-modal-overlay[hidden] { display: none; }
.blue-math-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 27000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(60, 64, 67, 0.48);
}
.blue-math-modal {
  width: min(1180px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #f8fafd;
  box-shadow: 0 20px 55px rgba(32, 33, 36, 0.3);
  color: #202124;
}
.blue-math-modal-header,
.blue-math-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
}
.blue-math-modal-header { border-bottom: 1px solid #dfe3e8; }
.blue-math-modal-footer { justify-content: flex-end; border-top: 1px solid #dfe3e8; }
.blue-math-modal-title { font-size: 20px; font-weight: 700; }
.blue-math-modal-subtitle { margin-top: 3px; color: #68717d; font-size: 11px; }
.blue-math-header-actions { display: flex; align-items: center; gap: 6px; }
.blue-math-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  cursor: pointer;
  font-size: 20px;
}
.blue-math-icon-btn:hover { background: #e9eef6; }
.blue-math-icon-btn:disabled { opacity: 0.35; cursor: default; }
.blue-math-modal-body { overflow: auto; padding: 20px 22px; }
.blue-math-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.blue-math-input {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid #aeb7c2;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  color: #202124;
  font: 16px/1.45 "SFMono-Regular", Consolas, monospace;
}
.blue-math-input:focus { border-color: #1a73e8; outline: 2px solid rgba(26, 115, 232, 0.18); }
.blue-math-templates { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.blue-math-template-btn {
  min-width: 54px;
  min-height: 38px;
  border: 1px solid #c7ced8;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  cursor: pointer;
  font: 17px "Cambria Math", "Times New Roman", serif;
}
.blue-math-template-btn:hover { border-color: #1a73e8; background: #eef4ff; }
.blue-math-ribbon {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 0.9fr) minmax(210px, 0.8fr);
  gap: 10px;
  margin-bottom: 16px;
}
.blue-math-ribbon-group {
  min-width: 0;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  padding: 9px;
  background: #fdfefe;
}
.blue-math-ribbon-group > strong {
  display: block;
  margin-bottom: 7px;
  color: #4b5563;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.blue-math-ribbon-buttons,
.blue-math-symbol-palette,
.blue-math-recent-symbols,
.blue-math-format-controls,
.blue-math-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.blue-math-ribbon button,
.blue-math-symbol-palette button,
.blue-math-recent-symbols button,
.blue-math-small-action,
.blue-math-clipboard-actions button {
  min-width: 34px;
  min-height: 30px;
  border: 1px solid #cbd3df;
  border-radius: 6px;
  padding: 3px 7px;
  background: #fff;
  color: #202124;
  cursor: pointer;
  font: 14px "Cambria Math", "Times New Roman", serif;
}
.blue-math-ribbon button:hover,
.blue-math-small-action:hover,
.blue-math-clipboard-actions button:hover { border-color: #1a73e8; background: #eef4ff; }
.blue-math-symbol-group select,
.blue-math-side-controls select {
  width: 100%;
  min-height: 32px;
  margin-bottom: 7px;
  border: 1px solid #cbd3df;
  border-radius: 6px;
  background: #fff;
}
.blue-math-symbol-palette { max-height: 74px; overflow: auto; }
.blue-math-recent-symbols {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e4e8ee;
}
.blue-math-mode-switch { margin-bottom: 8px; }
.blue-math-mode-switch button[aria-selected="true"] { border-color: #1a73e8; background: #dce9ff; color: #174ea6; }
.blue-math-format-controls input[type="number"] { width: 54px; }
.blue-math-format-controls input[type="color"] { width: 38px; min-height: 30px; padding: 2px; border: 1px solid #cbd3df; border-radius: 6px; }
.blue-math-matrix-size { display: inline-flex; align-items: center; gap: 2px; }
.blue-math-matrix-size input { width: 38px; min-height: 28px; box-sizing: border-box; border: 1px solid #cbd3df; border-radius: 5px; }
.blue-math-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 235px;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}
.blue-math-professional-panel,
.blue-math-linear-panel,
.blue-math-side-controls {
  min-width: 0;
  border: 1px solid #d7dde5;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.blue-math-linear-panel[hidden],
.blue-math-professional-panel[hidden] { display: none; }
.blue-math-structural-canvas {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border: 1px solid #cbd3df;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  font: 24px/1.25 "Cambria Math", "STIX Two Math", "Times New Roman", serif;
}
.blue-math-structural-canvas[data-justification="left"] { justify-content: flex-start; }
.blue-math-structural-canvas[data-justification="right"] { justify-content: flex-end; }
.blue-math-edit-row { display: inline-flex; align-items: center; }
.blue-math-edit-slot {
  display: inline-block;
  min-width: 0.72em;
  min-height: 1em;
  border-radius: 3px;
  padding: 0 0.06em;
  outline: none;
  white-space: pre;
}
.blue-math-edit-slot.is-empty {
  border: 1px dashed #8e99aa;
  background: #f5f8fc;
}
.blue-math-edit-slot.is-empty::before {
  content: "";
  display: inline-block;
  width: 0.65em;
}
.blue-math-edit-slot:focus {
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.35);
  background: #edf4ff;
}
.blue-math-unknown {
  display: inline-block;
  border: 1px dashed #b26a00;
  border-radius: 4px;
  padding: 0.05em 0.18em;
  background: #fff6e5;
  color: #6b4300;
}
.blue-math-keyboard-help { margin-top: 7px; color: #697386; font-size: 11px; }
.blue-math-side-controls { font-size: 12px; }
.blue-math-side-controls .blue-math-mode-row { flex-direction: column; gap: 7px; margin: 0 0 12px; }
.blue-math-clipboard-actions { display: grid; gap: 6px; margin-top: 12px; }
.blue-math-clipboard-actions button { width: 100%; font-family: Arial, sans-serif; font-size: 12px; }
.blue-math-partial-warning {
  margin-top: 10px;
  border: 1px solid #f0b95c;
  border-radius: 7px;
  padding: 8px;
  background: #fff7e7;
  color: #744b00;
  line-height: 1.35;
}
.blue-math-excel-panel[hidden] { display: none; }
.blue-math-excel-panel {
  margin: 0 0 14px;
  border: 1px solid #a9c7f7;
  border-radius: 10px;
  padding: 13px;
  background: #f4f8ff;
}
.blue-math-excel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.blue-math-excel-heading > div { display: grid; gap: 2px; }
.blue-math-excel-heading strong { color: #174ea6; font-size: 14px; }
.blue-math-excel-heading span,
.blue-math-excel-heading label,
.blue-math-excel-help { color: #5f6b7a; font-size: 11px; }
.blue-math-excel-heading label { display: flex; align-items: center; gap: 6px; }
.blue-math-excel-heading select { min-width: 48px; min-height: 30px; border: 1px solid #b8c4d5; border-radius: 6px; background: #fff; }
.blue-math-excel-help { margin: 0 0 10px; line-height: 1.4; }
.blue-math-excel-bindings { display: grid; gap: 6px; margin-bottom: 9px; }
.blue-math-excel-binding {
  display: grid;
  grid-template-columns: minmax(90px, 0.55fr) minmax(120px, 0.8fr) minmax(180px, 1.65fr);
  gap: 7px;
  align-items: center;
}
.blue-math-excel-binding > strong { overflow: hidden; text-overflow: ellipsis; color: #344054; font: 600 12px Arial, sans-serif; }
.blue-math-excel-binding select,
.blue-math-excel-binding input {
  min-width: 0;
  min-height: 31px;
  box-sizing: border-box;
  border: 1px solid #b8c4d5;
  border-radius: 6px;
  padding: 4px 7px;
  background: #fff;
  font: 12px/1.2 "SFMono-Regular", Consolas, monospace;
}
.blue-math-excel-empty { color: #68717d; font-size: 12px; }
.blue-math-excel-status { min-height: 18px; margin: 9px 0 6px; color: #5f6368; font-size: 12px; }
.blue-math-excel-status[data-status="exact"],
.blue-math-excel-status[data-status="equivalent"] { color: #137333; }
.blue-math-excel-status[data-status="requires-binding"],
.blue-math-excel-status[data-status="ambiguous"] { color: #9a5b00; }
.blue-math-excel-status[data-status="unsupported"] { color: #b3261e; }
#blueMathExcelFormula {
  width: 100%;
  min-height: 58px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid #b8c4d5;
  border-radius: 7px;
  padding: 10px;
  background: #fff;
  color: #202124;
  font: 13px/1.4 "SFMono-Regular", Consolas, monospace;
}
.blue-math-inspector { margin-top: 10px; color: #4f5968; font-size: 12px; }
.blue-math-inspector-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.blue-math-inspector-tabs label { font-weight: 700; }
.blue-math-inspector-tabs textarea {
  width: 100%;
  height: 88px;
  box-sizing: border-box;
  margin-top: 4px;
  resize: vertical;
  border: 1px solid #cbd3df;
  border-radius: 6px;
  padding: 7px;
  font: 10px/1.35 "SFMono-Regular", Consolas, monospace;
}
.blue-math-context-menu[hidden] { display: none; }
.blue-math-context-menu {
  position: fixed;
  z-index: 28000;
  min-width: 230px;
  display: grid;
  gap: 2px;
  border: 1px solid #c5ccd7;
  border-radius: 9px;
  padding: 5px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.blue-math-context-menu button {
  border: 0;
  border-radius: 5px;
  padding: 8px 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.blue-math-context-menu button:hover { background: #eef4ff; }
.blue-math-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.blue-math-mode-row { display: flex; gap: 22px; margin: 14px 0; font-size: 14px; }
.blue-math-mode-row label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.blue-math-preview {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border: 1px solid #d7dde5;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
  font-size: 22px;
}
.blue-math-help { margin: 12px 0 0; color: #5f6368; font-size: 12px; line-height: 1.5; }
.blue-math-error { min-height: 18px; margin-top: 7px; color: #b3261e; font-size: 12px; }
.blue-math-modal-btn {
  min-width: 104px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
}
.blue-math-modal-btn-secondary { background: transparent; color: #1a73e8; }
.blue-math-modal-btn-primary { background: #1a73e8; color: #fff; }
.blue-math-modal-btn-primary:disabled { background: #aeb7c2; cursor: default; }

@media (max-width: 900px) {
  .blue-math-ribbon { grid-template-columns: 1fr; }
  .blue-math-workspace { grid-template-columns: 1fr; }
  .blue-math-inspector-tabs { grid-template-columns: 1fr; }
  .blue-math-excel-heading { flex-direction: column; }
  .blue-math-excel-binding { grid-template-columns: 1fr; }
}

.recent-docs-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 28px 12px;
}

.recent-docs-modal-title {
  font-size: 22px;
  color: #202124;
}

.recent-docs-modal-actions-top {
  display: flex;
  gap: 10px;
}

.recent-docs-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 28px 18px;
}

.recent-docs-modal-body.list-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-docs-modal-body.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.recent-doc-card {
  background: #fff;
  border: 1px solid #d7dde3;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.recent-doc-card:hover {
  background: #f8f9fa;
}

.recent-doc-check {
  margin-top: 2px;
}

.recent-doc-icon {
  font-size: 20px;
  line-height: 1;
}

.recent-doc-icon.purple {
  color: #7b2cbf;
}

.recent-doc-icon.orange {
  color: #d96c0b;
  font-size: 14px;
  font-weight: 700;
}

.recent-doc-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.recent-doc-name {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-doc-date {
  margin-top: 4px;
  font-size: 12px;
  color: #5f6368;
}

.recent-docs-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px 24px;
}

.recent-docs-select-all {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #202124;
  cursor: pointer;
  user-select: none;
}

.recent-docs-select-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.recent-docs-modal-btn,
.recent-docs-view-btn,
.recent-docs-delete-btn {
  min-width: 104px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
}

.recent-docs-modal-btn-secondary,
.recent-docs-view-btn {
  background: transparent;
  color: #1a73e8;
}

.recent-docs-delete-btn {
  background: #d93025;
  color: #fff;
}

.recent-docs-delete-btn:disabled {
  background: #c7c9cc;
  cursor: default;
}

.ooxml-side-modal[hidden] {
  display: none;
}

.ooxml-side-modal {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 380px;
  z-index: 24000;
  pointer-events: none;
}

:root {
  --side-modal-top: 128px;
}

.ooxml-side-modal-window {
  position: absolute;
  top: var(--side-modal-top);
  width: var(--side-modal-width);
  height: var(--side-modal-height);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d0d7de;
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(60, 64, 67, 0.24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  backdrop-filter: blur(4px);
  opacity: 1;
  transition:
    top .28s ease,
    transform .28s ease,
    opacity .22s ease,
    box-shadow .22s ease;
  will-change: top, transform, opacity;
}

.ooxml-side-stack-controls[hidden] {
  display: none;
}

.ooxml-side-stack-controls {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 380px;
  z-index: 24150;
  pointer-events: none;
}

.ooxml-side-stack-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 16px;
  width: 360px;
  pointer-events: none;
}

.ooxml-side-stack-scroll-zone {
  position: absolute;
  left: 0;
  width: 360px;
  height: 73px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
  z-index: 2;
}

.ooxml-side-stack-scroll-zone.top {
  top: 0;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(
    to bottom,
    rgba(244, 246, 248, 0.92) 0%,
    rgba(244, 246, 248, 0.72) 55%,
    rgba(244, 246, 248, 0) 100%
  );
}

.ooxml-side-stack-scroll-zone.bottom {
  bottom: 0;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(
    to top,
    rgba(244, 246, 248, 0.92) 0%,
    rgba(244, 246, 248, 0.72) 55%,
    rgba(244, 246, 248, 0) 100%
  );
}

.ooxml-side-stack-scroll-zone.is-disabled {
  opacity: 0;
  pointer-events: none;
}

.ooxml-side-stack-scroll-zone svg {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.14));
  opacity: 0.78;
}

.ooxml-side-stack-scroll-zone:hover svg {
  opacity: 1;
}

.ooxml-side-stack-scroll-zone path {
  fill: rgba(95, 99, 104, 0.88);
}

.ooxml-side-modal-left {
  left: 0;
}

.ooxml-side-modal-right {
  right: 0;
}

.ooxml-side-modal-left .ooxml-side-modal-window {
  left: 16px;
}

.ooxml-side-modal-right .ooxml-side-modal-window {
  right: 16px;
}

.ooxml-side-modal-header {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid #eceff1;
  background: transparent;
  flex: 0 0 auto;
  gap: 12px;
}
.ooxml-side-modal-close-win,
.ooxml-palette-dot {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: 0 0 28px;
}

.ooxml-side-modal-close-win {
  background: transparent;
  color: #5f6368;
}

.ooxml-side-modal-close-win:hover {
  background: #f1f3f4;
  color: #202124;
}

.ooxml-side-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  background: transparent;
}

.ooxml-text-format-header {
  justify-content: space-between;
  padding: 8px 8px;
  gap: 4px;
}

.ooxml-text-format-top-btn {
  min-width: 0;
}

.ooxml-text-format-top-btn:hover {
  background: #f3f4f6;
}

.ooxml-text-format-top-btn.is-active {
  background: #1f2328;
  color: #ffffff;
  border-color: #1f2328;
}

.ooxml-modal-top-btn {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  border: 1px solid #d0d7de;
  background: #ffffff;
  color: #1f2328;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0 12px;
  height: 28px;
  min-height: 28px;
  font-size: 12px;
  line-height: 1;
  font-weight: 400;
  white-space: nowrap;
}

.ooxml-modal-top-btn:hover {
  background: #f3f4f6;
}

.ooxml-modal-top-btn.is-active {
  background: #1f2328;
  color: #ffffff;
  border-color: #1f2328;
}

.ooxml-text-format-biugroup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1;
  height: 14px;
}

.ooxml-text-format-top-icon {
  font-size: 12px;
  line-height: 1;
}

.ooxml-text-format-body {
  padding: 12px;
  background: transparent;
}

.blue-references-command-icon,
.ooxml-references-heading-icon,
.ooxml-references-action-icon,
.ooxml-references-nav-icon {
  display: inline-block;
  line-height: 1;
  letter-spacing: -1px;
}

.blue-references-command-icon sup,
.ooxml-references-heading-icon sup,
.ooxml-references-action-icon sup,
.ooxml-references-nav-icon sup {
  color: #d93025;
  font-size: .58em;
  margin-left: 1px;
}

.ooxml-references-header {
  justify-content: flex-start;
  padding: 8px;
  gap: 6px;
}

.ooxml-references-heading {
  gap: 8px;
  pointer-events: none;
}

.ooxml-references-heading-icon {
  font-size: 16px;
}

.ooxml-references-header-spacer {
  flex: 1 1 auto;
}

.ooxml-references-body {
  position: relative;
  padding: 12px;
  overflow: auto;
}

.ooxml-references-insert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ooxml-references-action-card {
  min-height: 116px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  color: #202124;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 8px;
  cursor: pointer;
  font: inherit;
}

.ooxml-references-action-card:hover,
.ooxml-references-show-notes:hover,
.ooxml-references-nav-primary:hover,
.ooxml-references-nav-toggle:hover {
  border-color: #a8c7fa;
  background: #f0f6ff;
}

.ooxml-references-action-card:focus-visible,
.ooxml-references-show-notes:focus-visible,
.ooxml-references-nav-primary:focus-visible,
.ooxml-references-nav-toggle:focus-visible,
.ooxml-references-nav-menu button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.ooxml-references-action-icon {
  font-size: 40px;
  font-family: Georgia, serif;
  font-weight: 400;
}

.ooxml-references-endnote-icon {
  position: relative;
  width: 46px;
  height: 42px;
  display: block;
}

.ooxml-references-endnote-icon i {
  position: absolute;
  width: 30px;
  height: 34px;
  border: 2px solid #aeb4bb;
  background: #fff;
}

.ooxml-references-endnote-icon i:first-child {
  left: 3px;
  top: 0;
}

.ooxml-references-endnote-icon i:nth-child(2) {
  left: 12px;
  top: 7px;
  border-color: #7baaf7;
}

.ooxml-references-endnote-icon b {
  position: absolute;
  right: 0;
  bottom: -1px;
  color: #1a73e8;
  font: 600 17px/1 Georgia, serif;
}

.ooxml-references-action-label {
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
}

.ooxml-references-nav-split {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  margin-bottom: 8px;
}

.ooxml-references-nav-primary,
.ooxml-references-nav-toggle,
.ooxml-references-show-notes {
  min-height: 44px;
  border: 1px solid #dadce0;
  background: #fff;
  color: #202124;
  cursor: pointer;
  font: 14px/1.25 Arial, sans-serif;
}

.ooxml-references-nav-primary {
  border-radius: 10px 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-align: left;
}

.ooxml-references-nav-icon {
  min-width: 52px;
  font-size: 19px;
}

.ooxml-references-nav-toggle {
  margin-left: -1px;
  border-radius: 0 10px 10px 0;
  font-size: 18px;
}

.ooxml-references-nav-toggle[aria-expanded="true"] {
  background: #e8f0fe;
  border-color: #8ab4f8;
}

.ooxml-references-nav-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: 6px;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(60, 64, 67, .22);
}

.ooxml-references-nav-menu[hidden] {
  display: none;
}

.ooxml-references-nav-menu button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #202124;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font: 14px/1.2 Arial, sans-serif;
  text-align: left;
}

.ooxml-references-nav-menu button:hover {
  background: #f1f3f4;
}

.ooxml-references-nav-menu button > span:first-child {
  color: #1a73e8;
  font-size: 17px;
}

.ooxml-references-show-notes {
  width: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  text-align: left;
}

.ooxml-references-notes-icon {
  color: #1a73e8;
  font-size: 24px;
}

.ooxml-references-status {
  min-height: 18px;
  margin: 2px 2px 0;
  color: #5f6368;
  font-size: 12px;
}

.ooxml-references-status.is-error {
  color: #b3261e;
}

.blue-header-footer-command-icon {
  display: inline-block;
  color: #1a73e8;
  font-size: 19px;
  line-height: 1;
}

.ooxml-header-footer-header {
  justify-content: flex-start;
  padding: 8px;
  gap: 6px;
}

.ooxml-header-footer-heading {
  gap: 8px;
  pointer-events: none;
}

.ooxml-header-footer-heading-icon {
  color: #1a73e8;
  font-size: 18px;
}

.ooxml-header-footer-header-spacer {
  flex: 1 1 auto;
}

.ooxml-header-footer-body {
  padding: 12px;
  overflow: auto;
}

.ooxml-header-footer-command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ooxml-header-footer-action-card {
  min-height: 92px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  color: #202124;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 6px;
  cursor: pointer;
  font: 12px/1.22 Arial, sans-serif;
  text-align: center;
}

.ooxml-header-footer-action-card:hover,
.ooxml-header-footer-nav-grid button:hover,
.ooxml-header-footer-close-edit:hover {
  border-color: #a8c7fa;
  background: #f0f6ff;
}

.ooxml-header-footer-action-card:focus-visible,
.ooxml-header-footer-nav-grid button:focus-visible,
.ooxml-header-footer-close-edit:focus-visible,
.ooxml-header-footer-check input:focus-visible,
.ooxml-header-footer-field-row select:focus-visible,
.ooxml-header-footer-distance-grid input:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.ooxml-header-footer-card-icon,
.ooxml-header-footer-page-icon,
.ooxml-header-footer-date-icon,
.ooxml-header-footer-field-icon,
.ooxml-header-footer-picture-icon {
  position: relative;
  width: 34px;
  height: 42px;
  box-sizing: border-box;
  color: #1a73e8;
  font: 26px/42px Georgia, serif;
}

.ooxml-header-footer-card-icon {
  border: 1.5px solid #59636e;
  background: #fff;
}

.ooxml-header-footer-card-icon::after {
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  height: 4px;
  border: 1px solid #f2994a;
  background: #fff4e5;
}

.ooxml-header-footer-card-icon.is-header::after { top: 6px; }
.ooxml-header-footer-card-icon.is-footer::after { bottom: 6px; }

.ooxml-header-footer-page-icon {
  border: 1.5px solid #59636e;
  font-size: 24px;
}

.ooxml-header-footer-date-icon,
.ooxml-header-footer-field-icon,
.ooxml-header-footer-picture-icon {
  font-family: Arial, sans-serif;
  font-size: 31px;
}

.ooxml-header-footer-field-row,
.ooxml-header-footer-distance-grid label {
  display: grid;
  gap: 5px;
  color: #5f6368;
  font-size: 12px;
}

.ooxml-header-footer-field-row {
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  margin-top: 9px;
}

.ooxml-header-footer-field-row select,
.ooxml-header-footer-distance-grid input {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  color: #202124;
  padding: 5px 8px;
  font: 13px/1.2 Arial, sans-serif;
}

.ooxml-header-footer-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.ooxml-header-footer-nav-grid button,
.ooxml-header-footer-close-edit {
  min-height: 42px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: #fff;
  color: #202124;
  cursor: pointer;
  font: 13px/1.2 Arial, sans-serif;
}

.ooxml-header-footer-nav-grid button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  text-align: left;
}

.ooxml-header-footer-nav-grid button span {
  min-width: 20px;
  color: #1a73e8;
  font-size: 20px;
}

.ooxml-header-footer-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  color: #202124;
  font-size: 13px;
  cursor: pointer;
}

.ooxml-header-footer-check.is-link {
  margin-top: 7px;
}

.ooxml-header-footer-check input {
  width: 17px;
  height: 17px;
  accent-color: #1a73e8;
}

.ooxml-header-footer-check input:disabled + span {
  color: #9aa0a6;
}

.ooxml-header-footer-distance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.ooxml-header-footer-close-edit {
  width: 100%;
  color: #b3261e;
  border-color: #f1c0bc;
  font-weight: 600;
}

.ooxml-header-footer-close-edit span {
  margin-right: 7px;
  font-size: 20px;
  vertical-align: -1px;
}

.ooxml-header-footer-status {
  min-height: 18px;
  margin: 8px 2px 0;
  color: #5f6368;
  font-size: 12px;
}

.ooxml-header-footer-status.is-error {
  color: #b3261e;
}

.ooxml-note-item-active {
  outline: 2px solid rgba(26, 115, 232, .55);
  outline-offset: 3px;
  border-radius: 4px;
}

.ooxml-text-format-section {
  margin-bottom: 16px;
}

.ooxml-text-format-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  margin-bottom: 8px;
}

.ooxml-text-format-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ooxml-text-format-align-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
}

.ooxml-text-format-line-spacing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  flex-wrap: nowrap;
}

.ooxml-text-format-line-spacing-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3c4043;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.ooxml-text-format-line-spacing-btn:hover {
  background: #f1f3f4;
}

.ooxml-text-format-line-spacing-btn.active {
  background: #dfe7f6;
  color: #1967d2;
}

.ooxml-text-format-line-spacing-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 500;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ooxml-text-format-line-spacing-gear-icon {
  width: 20px;
  height: 20px;
  display: block;
  color: inherit;
}

.ooxml-text-format-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ooxml-text-format-align-btn {
  flex: 0 0 auto;
}

.ooxml-text-format-marks-icon {
  width: 20px;
  height: 20px;
  display: block;
  color: inherit;
}

.ooxml-text-format-option {
  min-height: 38px;
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
  color: #202124;
  text-align: left;
  box-sizing: border-box;
}

.ooxml-text-format-option:hover {
  background: #f8f9fa;
}

.ooxml-text-format-option.is-active {
  background: #e8f0fe;
  border-color: #aecbfa;
  color: #174ea6;
}

.ooxml-text-format-font-option {
  font-size: 16px;
}

.ooxml-text-format-style-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}

.ooxml-text-format-style-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3c4043;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
  text-align: center;
}

.ooxml-text-format-style-row:last-child {
  margin-bottom: 0;
}

.ooxml-text-format-style-btn:hover {
  background: #f1f3f4;
}

.ooxml-text-format-style-btn.is-active {
  background: #dfe7f6;
  color: #1967d2;
}

.ooxml-text-format-underline-split {
  display: inline-flex;
  align-items: stretch;
  width: 52px;
  min-width: 52px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
}

.ooxml-text-format-underline-split .ooxml-text-format-style-btn {
  width: 34px;
  min-width: 34px;
  border-radius: 10px 0 0 10px;
}

.ooxml-text-format-underline-arrow {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  min-width: 18px;
  padding: 0;
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: #3c4043;
  font: 700 14px/1 Arial, sans-serif;
  cursor: pointer;
}

.ooxml-text-format-underline-arrow:hover,
.ooxml-text-format-underline-arrow[aria-expanded="true"] {
  background: #e8eaed;
  border-left-color: #d2d5da;
}

.ooxml-text-format-underline-split:has(.ooxml-text-format-style-btn.is-active) {
  background: #dfe7f6;
  color: #1967d2;
}

.ooxml-text-format-underline-gallery {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: -2px 0 8px;
  padding: 6px;
  border: 1px solid #c9cdd3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(60, 64, 67, 0.2);
}

.ooxml-text-format-underline-option {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #fff;
  color: #202124;
  cursor: pointer;
}

.ooxml-text-format-underline-option:hover,
.ooxml-text-format-underline-option.is-active {
  border-color: #8ab4f8;
  background: #e8f0fe;
}

.ooxml-text-format-underline-preview,
.ooxml-text-format-underline-preview svg {
  display: block;
  width: 100%;
  height: 18px;
}

.ooxml-text-format-style-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 500;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ooxml-text-format-font-size-row:last-child {
  margin-bottom: 0;
}

.ooxml-text-format-font-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}

.ooxml-text-format-size-option {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3c4043;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  font-family: Arial, "Segoe UI", sans-serif;
  box-sizing: border-box;
}

.ooxml-text-format-size-option:hover {
  background: #f1f3f4;
}

.ooxml-text-format-size-option.is-active {
  background: #dfe7f6;
  color: #1967d2;
}

.ooxml-text-format-size-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 500;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.ooxml-text-format-lists-grid {
  margin-top: 2px;
  display: grid;
  grid-template-columns: repeat(4, minmax(54px, 1fr));
  gap: 7px;
  justify-content: start;
}

.ooxml-text-format-list-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 98px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 2px;
  cursor: pointer;
  padding: 6px 5px;
  text-align: left;
  color: #202124;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-style-grid.ooxml-text-format-lists-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(54px, 1fr));
  gap: 7px;
  justify-content: start;
}

.ooxml-text-format-list-card.is-active {
  border-color: #1a73e8;
  box-shadow: 0 0 0 1px #1a73e8 inset;
  background: #f8fbff;
}

.ooxml-side-modal-stack-animating .ooxml-side-modal-window {
  box-shadow: 0 18px 42px rgba(60, 64, 67, 0.28);
}

.ooxml-palette-header-dots {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ooxml-palette-dot {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.ooxml-palette-dot:hover {
  transform: scale(1.06);
}

.ooxml-palette-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 6px 2px 2px;
}

.ooxml-palette-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  transition: transform .16s ease, box-shadow .16s ease;
}

.ooxml-palette-swatch:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}

.ooxml-palette-label {
  font-size: 13px;
  color: #5f6368;
  margin-bottom: 8px;
}

.ooxml-tone-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50000;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.92),
    0 0 0 3px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity .12s ease, background-color .12s ease;
  background: transparent;
}

.ooxml-tone-cursor.is-visible {
  opacity: 1;
}

.ooxml-tone-cursor.is-outline-only {
  background: transparent !important;
}

#ooxmlEngineHost {
  --ooxml-workspace-bg: #abd5fb;
  --ooxml-workspace-border: 0;
  background: var(--ooxml-workspace-bg);
}

#ooxmlEngineHost {
  --ooxml-workspace-bg: #abd5fb;
  background: var(--ooxml-workspace-bg);
}

#ooxmlGreenEngineHost {
  --ooxml-workspace-bg: #DDEBDD;
  background: var(--ooxml-workspace-bg);
}

.green-editor-root {
  width: 100%;
  min-height: 420px;
  background: var(--ooxml-workspace-bg);
  overflow: auto;
}

.green-grid {
  min-width: max-content;
  padding: 12px;
  background: var(--ooxml-workspace-bg);
}

.ooxml-surface {
  position: relative;
  background: var(--ooxml-workspace-bg);
  min-height: 100%;
}

/* Show/Hide ¶ is a BLUE view overlay. It projects the native WordprocessingML
   characters without inserting the visible glyphs into editable text or DOCX. */
.ooxml-formatting-marks-layer {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 45;
  overflow: visible;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  color: #111;
}

.ooxml-formatting-mark {
  position: absolute;
  display: block;
  transform: translate(-50%, -50%);
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: #111;
  text-shadow: 0 0 1px rgba(255, 255, 255, .9);
}

.ooxml-formatting-mark-space,
.ooxml-formatting-mark-nbsp {
  font-size: 12px;
  transform: translate(-50%, -43%);
}

.ooxml-formatting-mark-tab,
.ooxml-formatting-mark-line-break,
.ooxml-formatting-mark-soft-hyphen {
  font-size: 14px;
}

.ooxml-formatting-mark-structural-break {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .4px;
  color: #333;
}

.ooxml-formatting-mark-anchor {
  color: #1f1f1f;
  font-size: 14px;
}

/* ISO/IEC 29500-1 §17.3.2.41: hidden text is absent in normal display. Word's
   Show All view reveals it with a dotted underline; the property stays native. */
.ooxml-hidden-text {
  display: none;
}

.ooxml-surface.show-formatting-marks .ooxml-hidden-text {
  display: inline;
  text-decoration-line: underline !important;
  text-decoration-style: dotted !important;
  text-underline-offset: 2px;
}

.ooxml-page-header,
.ooxml-page-footer {
  position: absolute;
  box-sizing: border-box;
  z-index: 10;
  pointer-events: none;
  width: auto;
}

.ooxml-header-footer-paragraph {
  position: relative;
  z-index: 11;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.ooxml-page-header {
  top: 0;
}

.ooxml-page-footer {
  bottom: 0;
}

.ooxml-page-frame {
  position: relative;
  width: fit-content;
  margin: 0 auto 24px auto;
  perspective: none;
  transform-origin: center center;
  padding-left: calc(var(--rotate-btn-width, 0px) + 12px);
  box-sizing: content-box;
}

.ooxml-engine-mode #ooxmlEngineHost .ooxml-page-frame {
  margin: 0 0 24px 5vw;
}

.ooxml-page {
  position: relative;
  transform-origin: center center;
  backface-visibility: visible;
  user-select: text;
  -webkit-user-select: text;
  transition:
    width .28s ease,
    min-height .28s ease,
    padding .28s ease,
    box-shadow .28s ease;
}

.ooxml-page-frame.is-plane-flipping {
  z-index: 30;
}

.ooxml-page-frame.is-plane-flipping .ooxml-page {
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
}

.ooxml-page-rotate-btn {
  position: absolute;
  top: 0px;
  left: -10px;
  width: var(--rotate-btn-width);
  height: var(--rotate-btn-height);
  border: 0;
  border-radius: 9px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 4px 14px rgba(0,0,0,0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  padding: 0;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  transition:
    opacity .18s ease,
    background .2s ease,
    box-shadow .2s ease;
}

.ooxml-surface.is-plane-flipping .ooxml-page-rotate-btn {
  opacity: 0;
  pointer-events: none;
}

.ooxml-page-rotate-btn:hover {
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.ooxml-page-rotate-btn svg {
  width: 48%;
  height: 48%;
  display: block;
}

.ooxml-page-rotate-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.ooxml-tone-apply-all-target {
  position: absolute;
  top: 24px;
  right: 24px;
  bottom: 24px;
  left: auto;
  width: 18px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.96);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.22);
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  transition:
    opacity .14s ease,
    background-color .14s ease,
    box-shadow .14s ease,
    border-color .14s ease;
  z-index: 1;
}

.ooxml-tone-apply-all-target.is-visible {
  opacity: 1;
}

.ooxml-tone-apply-all-target.is-hovered {
  background: var(--tone-apply-all-fill, transparent);
  border-color: rgba(255,255,255,0.98);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.18),
    0 0 0 4px rgba(255,255,255,0.08);
}

.ooxml-tone-apply-paragraph-target {
  position: absolute;
  top: 24px;
  right: 48px;
  width: 18px;
  height: 24px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.96);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.22);
  background: transparent;
  opacity: 0;
  pointer-events: auto;
  transition:
    opacity .14s ease,
    top .08s ease,
    height .08s ease,
    background-color .14s ease,
    box-shadow .14s ease,
    border-color .14s ease;
  z-index: 1;
}

.ooxml-tone-apply-paragraph-target.is-visible {
  opacity: 1;
}

.ooxml-tone-apply-paragraph-target.is-hovered {
  background: var(--tone-apply-paragraph-fill, transparent);
  border-color: rgba(255,255,255,0.98);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.18),
    0 0 0 4px rgba(255,255,255,0.08);
}

.ooxml-page-setup-window {
  --side-modal-height: 560px;
}

.ooxml-page-setup-group {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eceff1;
}

.ooxml-page-setup-group:last-child {
  border-bottom: 0;
}

.ooxml-page-setup-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #202124;
}

.ooxml-page-setup-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.ooxml-page-setup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ooxml-page-setup-field label {
  font-size: 12px;
  color: #5f6368;
}

.ooxml-page-setup-field input,
.ooxml-page-setup-field select {
  height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
}

.ooxml-page-setup-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.ooxml-page-setup-btn {
  flex: 1 1 auto;
  height: 36px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.ooxml-page-setup-btn-primary {
  background: #1a73e8;
  color: #fff;
}

.ooxml-page-setup-btn-secondary {
  background: #f1f3f4;
  color: #202124;
}

.cleanup-modal {
  background: #f1f4f9;
}

.cleanup-modal-body {
  gap: 14px;
}

.cleanup-modal-section {
  background: #fff;
  border: 1px solid #d7dde3;
  border-radius: 14px;
  padding: 16px;
}

.cleanup-modal-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #202124;
  margin-bottom: 12px;
}

.cleanup-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #202124;
  margin-bottom: 10px;
  cursor: pointer;
}

.cleanup-modal-check input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.cleanup-modal-indent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.cleanup-modal-indent-row label {
  font-size: 13px;
  color: #5f6368;
}

.cleanup-modal-indent-row input {
  width: 84px;
  height: 34px;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  background: #fff;
}

.cleanup-modal-summary {
  font-size: 14px;
  line-height: 1.45;
  color: #202124;
  margin-bottom: 10px;
}

.cleanup-modal-preview {
  max-height: 180px;
  overflow: auto;
  border: 1px solid #eceff1;
  border-radius: 10px;
  background: #fbfcfe;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  white-space: pre-wrap;
}

.cleanup-modal-preview-item {
  padding: 6px 0;
  border-bottom: 1px solid #eceff1;
}

.cleanup-modal-preview-item:last-child {
  border-bottom: 0;
}

.cleanup-modal-hit {
  background: #fff3b0;
  border-radius: 3px;
  padding: 0 2px;
}

.cleanup-modal-footer {
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .ooxml-side-modal {
    width: 340px;
  }

  .ooxml-side-modal-window {
    width: 320px;
  }
}

    @media (max-width: 700px) {
      .toolbar {
        padding: 4px 0;
      }

      .toolbar .group::after {
        display: none;
      }

    }

.green-editor-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.green-editor-topbar {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
  padding: 10px 12px 0;
  background: var(--ooxml-workspace-bg);
}

.green-formula-wrap {
  display: grid;
  grid-template-columns: 90px 38px minmax(240px, 1fr);
  gap: 8px;
  align-items: center;
}

.green-name-box,
.green-formula-fx,
.green-formula-input,
.green-sheet-tab {
  font: inherit;
}

.green-name-box,
.green-formula-fx {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #c7d4c7;
  border-radius: 8px;
  color: #2f5130;
}

.green-formula-input {
  min-height: 34px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #c7d4c7;
  border-radius: 8px;
  background: #fff;
  outline: none;
}

.green-formula-input:focus {
  border-color: #34a853;
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.14);
}

.green-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 8px;
  position: relative;
}

.green-sheet-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
  overflow-x: auto;
  background: var(--ooxml-workspace-bg);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.green-sheet-tab {
  padding: 7px 12px;
  border: 1px solid #b8cbb8;
  border-radius: 999px;
  background: #f7fbf7;
  color: #2f5130;
  cursor: pointer;
  white-space: nowrap;
}

.green-sheet-tab.is-active {
  background: #fff;
  border-color: #34a853;
  box-shadow: inset 0 0 0 1px #34a853;
}

.green-cell.is-active {
  border-color: #34a853;
  box-shadow: inset 0 0 0 2px #34a853;
  position: relative;
  z-index: 1;
}

/* USC-218 — діапазон належить моделі аркуша, а ці класи лише малюють
 * видимий фрагмент. Тому після віконного перемальовування/scroll нові
 * клітинки знову отримують правильне виділення. */
.green-cell.is-selected {
  background: #e8f3e9;
}

.green-cell.is-selection-top { border-top: 2px solid #34a853; }
.green-cell.is-selection-right { border-right: 2px solid #34a853; }
.green-cell.is-selection-bottom { border-bottom: 2px solid #34a853; }
.green-cell.is-selection-left { border-left: 2px solid #34a853; }

.green-col-header,
.green-row-header,
.green-corner {
  cursor: default;
  user-select: none;
}

.green-col-header.is-selected,
.green-row-header.is-selected,
.green-corner.is-selected {
  background: #d6ead8;
  color: #1f6f2a;
  font-weight: 700;
}

.green-cell:not([data-editing="true"]) {
  cursor: cell;
}

/* Excel-style fill handle — 7×7 square anchored at the bottom-right corner
 * of the active cell. Lives in the grid-scroll positioning context, so it
 * tracks the cell across scroll without needing layout changes. */
.green-fill-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #34a853;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px #34a853;
  cursor: crosshair;
  z-index: 4;
  transform: translate(-6px, -6px);
  pointer-events: auto;
  user-select: none;
}

.green-fill-preview {
  position: absolute;
  border: 1.5px dashed #34a853;
  background: transparent;
  pointer-events: none;
  z-index: 3;
}

.green-formula-fx {
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  padding: 0 6px;
}

.green-formula-fx:hover {
  background: #eaf3ea;
  border-color: #34a853;
  color: #1f6f2a;
}

.green-formula-fx:active {
  background: #d7ebd7;
}

.green-formula-fx:focus-visible {
  outline: 2px solid #34a853;
  outline-offset: 1px;
}

/* Formula Builder (side modal) ============================================
 * The Formula Builder has its own physics: it slides in from the right edge
 * of the viewport as a full-height panel, rather than stacking vertically
 * like the other OOXML side modals.
 */
#ooxmlFormulaBuilderModal {
  top: 0;
  bottom: 0;
  right: 0;
  width: 380px;
  pointer-events: auto;
}

#ooxmlFormulaBuilderModal .ooxml-side-modal-window {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 1px solid #d0d7de;
  box-shadow: -14px 0 36px rgba(60, 64, 67, 0.24);
  transform: translateX(100%);
  opacity: 1;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

#ooxmlFormulaBuilderModal.is-open .ooxml-side-modal-window {
  transform: translateX(0);
}

.ooxml-formula-builder-window {
  --formula-builder-accent: #34a853;
}

.ooxml-formula-builder-title {
  font-weight: 600;
  font-size: 15px;
  color: #1f2328;
  padding-left: 6px;
}

.ooxml-formula-builder-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}

.ooxml-formula-builder-search {
  position: relative;
  flex: 0 0 auto;
}

.ooxml-formula-builder-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #6b7280;
  pointer-events: none;
}

.ooxml-formula-builder-search-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px 6px 30px;
  font: inherit;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.ooxml-formula-builder-search-input:focus {
  border-color: var(--formula-builder-accent);
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.14);
}

.ooxml-formula-builder-list {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 4px 0;
}

.ooxml-formula-builder-group-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  padding: 8px 12px 4px;
  letter-spacing: 0.02em;
}

.ooxml-formula-builder-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px 7px 24px;
  background: transparent;
  border: 0;
  color: #1f2328;
  font: inherit;
  cursor: pointer;
}

.ooxml-formula-builder-item:hover {
  background: #f3f4f6;
}

.ooxml-formula-builder-item.is-selected {
  background: #d7ebd7;
  color: #1f6f2a;
  font-weight: 600;
}

.ooxml-formula-builder-item-name {
  font-weight: 600;
  color: inherit;
  font-size: 13px;
}

.ooxml-formula-builder-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ooxml-formula-builder-item-category {
  flex: 0 1 auto;
  overflow: hidden;
  color: #7b8490;
  font-size: 10.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ooxml-formula-builder-item-desc {
  display: block;
  font-weight: 400;
  color: #6b7280;
  font-size: 11.5px;
  margin-top: 2px;
  line-height: 1.3;
  white-space: normal;
}

.ooxml-formula-builder-item.is-selected .ooxml-formula-builder-item-desc {
  color: #3f6f2a;
}

.ooxml-formula-builder-section-title {
  padding: 8px 14px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  background: #f9fafb;
  border-bottom: 1px solid #eef0f2;
}

.ooxml-formula-builder-no-args {
  font-size: 12.5px;
  color: #6b7280;
  padding: 4px 0 0;
}

.ooxml-formula-builder-optional {
  color: #9ca3af;
  font-weight: 400;
  font-size: 11px;
}

.ooxml-formula-builder-empty {
  padding: 16px 12px;
  color: #6b7280;
  font-size: 13px;
  text-align: center;
}

/* ---------------------------------------------------------------------------
 * Text Format modal → Fonts panel (search + MRU + grouped list).
 * Visual vocabulary mirrors the Formula Builder list so the two pickers feel
 * part of the same family.
 * ------------------------------------------------------------------------ */
.ooxml-text-format-font-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ooxml-text-format-font-picker-search {
  position: relative;
  flex: 0 0 auto;
}

.ooxml-text-format-font-picker-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #6b7280;
  pointer-events: none;
}

.ooxml-text-format-font-picker-search-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px 6px 30px;
  font: inherit;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.ooxml-text-format-font-picker-search-input:focus {
  border-color: #2f86ff;
  box-shadow: 0 0 0 2px rgba(47, 134, 255, 0.14);
}

.ooxml-text-format-font-picker-list {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 4px 0;
}

.ooxml-text-format-font-picker-section-title {
  padding: 8px 14px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  background: #f9fafb;
  border-bottom: 1px solid #eef0f2;
}

.ooxml-text-format-font-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  background: transparent;
  border: 0;
  color: #1f2328;
  font: inherit;
  cursor: pointer;
}

.ooxml-text-format-font-picker-item:hover {
  background: #f3f4f6;
}

.ooxml-text-format-font-picker-item.is-selected {
  background: #dbe8ff;
  color: #1d4fb5;
  font-weight: 600;
}

.ooxml-text-format-font-picker-item-name {
  display: block;
  font-weight: 600;
  color: inherit;
  font-size: 14px;
  line-height: 1.3;
}

.ooxml-text-format-font-picker-item-desc {
  display: block;
  font-weight: 400;
  color: #6b7280;
  font-size: 11.5px;
  margin-top: 2px;
  line-height: 1.3;
  white-space: normal;
}

.ooxml-text-format-font-picker-empty {
  padding: 16px 12px;
  color: #6b7280;
  font-size: 13px;
  text-align: center;
}

.ooxml-formula-builder-detail {
  flex: 1 1 auto;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
}

.ooxml-formula-builder-detail[hidden] {
  display: none;
}

.ooxml-formula-builder-detail-name {
  font-weight: 700;
  color: #1f6f2a;
  font-size: 14px;
}

.ooxml-formula-builder-detail-category {
  color: #6b7280;
  font-size: 11px;
}

.ooxml-formula-builder-detail-sig {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: #374151;
  background: #fff;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.ooxml-formula-builder-detail-desc {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.4;
}

.ooxml-formula-builder-args {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ooxml-formula-builder-arg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: start;
  padding: 6px 0;
  border-top: 1px solid #eef0f2;
}

.ooxml-formula-builder-arg-label {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}

.ooxml-formula-builder-arg-input {
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  font: inherit;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.ooxml-formula-builder-arg-input:focus {
  border-color: var(--formula-builder-accent);
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.14);
}

.ooxml-formula-builder-arg-hint {
  color: #7b8490;
  font-size: 10.5px;
  line-height: 1.35;
}

.ooxml-formula-builder-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
  /* Pin the insert button to the very bottom of the full-height Formula
   * Builder panel regardless of how much or little detail the selected
   * function shows in the middle of the panel. */
  margin-top: auto;
  flex: 0 0 auto;
  border-top: 1px solid #eef0f2;
  background: inherit;
}

.ooxml-formula-builder-insert-btn {
  min-height: 34px;
  padding: 6px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--formula-builder-accent);
  border: 1px solid var(--formula-builder-accent);
  border-radius: 8px;
  cursor: pointer;
}

.ooxml-formula-builder-insert-btn:hover:not(:disabled) {
  background: #2b8e46;
  border-color: #2b8e46;
}

.ooxml-formula-builder-insert-btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.green-cell.is-formula:not(.is-selected) {
  background: #fcfff7;
}
/* ===========================================================================
   Стартова сторінка (як у Microsoft Word): ліва навігація, шаблони, останні
   =========================================================================== */

.start-screen[hidden] {
  display: none;
}

/* USC-342: стартова сторінка видима ще до скриптів, але її кнопки ведуть у
   функції, яких іще немає, — клік нічого б не відкрив, лише кинув
   ReferenceError. Доки data-booting не знято, кнопки не реагують, а підпис
   #startScreenBusy пояснює чому. */
.start-screen[data-booting] .start-screen-rail,
.start-screen[data-booting] .start-screen-main {
  pointer-events: none;
}

/* USC-343: з кешу редактор стартує за десяті частки секунди — підпис, що
   блимає на мить при кожному перезавантаженні, лише лякав би. Тож він
   з'являється, тільки коли завантаження справді затяглося (перший візит,
   повільна мережа). Стосується лише старту: «Відкриваємо…» з
   setStartScreenBusy() показується одразу. */
.start-screen[data-booting] #startScreenBusy {
  animation: start-screen-busy-appear 0.2s ease-out 0.8s both;
}

@keyframes start-screen-busy-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.start-screen {
  --start-bg: #f7f7f7;
  --start-text: #242424;
  --start-muted: #616161;
  --start-rail-bg: #f0f0f0;
  --start-rail-border: #e1e1e1;
  --start-rail-hover: #e6e6e6;
  --start-rail-active: #e0e0e0;
  --start-accent: #0f6cbd;
  --start-accent-strong: #075e9d;
  --start-section-border: #e3e3e3;
  --start-preview-bg: #fff;
  --start-preview-border: #d6d6d6;
  --start-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  --start-preview-hover-shadow: 0 2px 10px rgba(15, 108, 189, 0.25);
  --start-template-name: #333;
  --start-template-selected-bg: #0f6cbd;
  --start-template-selected-text: #fff;
  --start-avatar-bg: #b8d4f0;
  --start-avatar-hover: #a8ccec;
  --start-avatar-text: #1a3e66;
  --start-focus: #0b78d0;
  --start-skip-hover: #eaf3fb;
  --start-sheet-bg: #f4faf4;
  --start-sheet-grid: #dbe8db;
  --start-sheet-border: #c7dcc7;
  --start-open-bg: #f5f9ff;
  --start-stream-bg: linear-gradient(145deg, #e8f4ff 0%, #f8fbff 54%, #d9f1ec 100%);
  --start-stream-shadow: 0 5px 18px rgba(15, 108, 189, 0.18);
  --start-stream-files: #185b86;
  --start-stream-line-bg: #0f6cbd;
  --start-stream-line-text: #fff;
  --start-stream-line-shadow: 0 4px 10px rgba(15, 108, 189, 0.26);
  --start-recent-hover: #eef4fb;
  --start-rail-text: #424242;
  --start-heading: #333;
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  background: var(--start-bg, #f7f7f7);
  color: var(--start-text, #242424);
  font-family: 'Segoe UI', Arial, sans-serif;
}

.start-screen[data-start-style="blue-green"] {
  --start-bg: linear-gradient(145deg, #e8f4ff 0%, #f8fbff 54%, #d9f1ec 100%);
  --start-text: #123d5a;
  --start-muted: #185b86;
  --start-rail-bg: rgba(232, 244, 255, 0.88);
  --start-rail-border: rgba(15, 108, 189, 0.26);
  --start-rail-hover: rgba(15, 108, 189, 0.10);
  --start-rail-active: rgba(15, 108, 189, 0.16);
  --start-accent: #0f6cbd;
  --start-accent-strong: #075e9d;
  --start-section-border: rgba(15, 108, 189, 0.18);
  --start-preview-bg: rgba(255, 255, 255, 0.82);
  --start-preview-border: rgba(15, 108, 189, 0.28);
  --start-card-shadow: 0 5px 18px rgba(15, 108, 189, 0.14);
  --start-preview-hover-shadow: 0 3px 14px rgba(15, 108, 189, 0.28);
  --start-template-name: #123d5a;
  --start-template-selected-bg: #0f6cbd;
  --start-template-selected-text: #fff;
  --start-avatar-bg: #b8dff1;
  --start-avatar-hover: #9dcce5;
  --start-avatar-text: #123d5a;
  --start-focus: #0f6cbd;
  --start-skip-hover: rgba(15, 108, 189, 0.10);
  --start-sheet-bg: rgba(237, 250, 244, 0.86);
  --start-sheet-grid: #badfce;
  --start-sheet-border: #91cbb4;
  --start-open-bg: rgba(239, 248, 255, 0.9);
  --start-stream-bg: rgba(255, 255, 255, 0.72);
  --start-stream-shadow: 0 7px 22px rgba(15, 108, 189, 0.2);
  --start-stream-files: #185b86;
  --start-stream-line-bg: #0f6cbd;
  --start-stream-line-text: #fff;
  --start-stream-line-shadow: 0 4px 10px rgba(15, 108, 189, 0.26);
  --start-recent-hover: rgba(15, 108, 189, 0.09);
  --start-rail-text: #123d5a;
  --start-heading: #123d5a;
}

.start-screen[data-start-style="dark-mode"] {
  color-scheme: dark;
  --start-bg: linear-gradient(145deg, #020617 0%, #0f172a 52%, #111827 100%);
  --start-text: #f8fafc;
  --start-muted: #cbd5e1;
  --start-rail-bg: rgba(2, 6, 23, 0.92);
  --start-rail-border: #1e293b;
  --start-rail-hover: rgba(148, 163, 184, 0.16);
  --start-rail-active: rgba(96, 165, 250, 0.22);
  --start-accent: #60a5fa;
  --start-accent-strong: #93c5fd;
  --start-section-border: #1e293b;
  --start-preview-bg: #111827;
  --start-preview-border: #334155;
  --start-card-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  --start-preview-hover-shadow: 0 5px 18px rgba(96, 165, 250, 0.28);
  --start-template-name: #f8fafc;
  --start-template-selected-bg: #2563eb;
  --start-template-selected-text: #ffffff;
  --start-avatar-bg: #1e3a5f;
  --start-avatar-hover: #264b78;
  --start-avatar-text: #dbeafe;
  --start-focus: #93c5fd;
  --start-skip-hover: rgba(148, 163, 184, 0.16);
  --start-sheet-bg: #14231a;
  --start-sheet-grid: #3f6850;
  --start-sheet-border: #4b755b;
  --start-open-bg: #13213a;
  --start-stream-bg: linear-gradient(145deg, #0f2747 0%, #111827 54%, #123b38 100%);
  --start-stream-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  --start-stream-files: #bfdbfe;
  --start-stream-line-bg: #2563eb;
  --start-stream-line-text: #fff;
  --start-stream-line-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  --start-recent-hover: rgba(96, 165, 250, 0.14);
  --start-rail-text: #f8fafc;
  --start-heading: #f8fafc;
}

.start-screen-rail {
  flex: 0 0 96px;
  background: var(--start-rail-bg, #f0f0f0);
  border-right: 1px solid var(--start-rail-border, #e1e1e1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 8px;
}

.start-screen-avatar {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--start-avatar-bg, #b8d4f0);
  color: var(--start-avatar-text, #1a3e66);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  margin-bottom: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.start-screen-avatar:hover {
  background: var(--start-avatar-hover, #a8ccec);
}

.start-screen-avatar:focus-visible {
  outline: 3px solid var(--start-focus, #0b78d0);
  outline-offset: 3px;
}

.start-screen-avatar.has-initials {
  letter-spacing: 0.02em;
}

.start-profile-avatar-text {
  font-size: 16px;
  line-height: 1;
}

.start-profile-avatar-icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--start-avatar-text, #1a3e66);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.start-profile-avatar-text[hidden],
.start-profile-avatar-icon[hidden] {
  display: none !important;
}

.start-profile-overlay[hidden] {
  display: none;
}

.start-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 51000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.46);
}

.start-profile-modal {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  font-family: 'Segoe UI', Arial, sans-serif;
}

.start-profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 16px;
  border-bottom: 1px solid #edf0f4;
}

.start-profile-title {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
}

.start-profile-lead {
  margin: 0;
  color: #5f6b7a;
  font-size: 14px;
  line-height: 1.45;
}

.start-profile-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.start-profile-close:hover {
  background: #e5e7eb;
}

.start-profile-status {
  margin: 16px 26px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
}

.start-profile-status.is-success {
  background: #ecfdf3;
  color: #166534;
}

.start-profile-status.is-error {
  background: #fef2f2;
  color: #b91c1c;
}

.start-profile-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 20px 26px 26px;
}

.start-profile-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.start-profile-nav-btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: #374151;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.start-profile-nav-btn:hover {
  background: #eef2f7;
}

.start-profile-nav-btn.active {
  background: #e0f2fe;
  color: #075985;
}

.start-profile-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
  background: #fbfdff;
}

.start-profile-card-title {
  margin: 0 0 14px;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
}

.start-profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.start-profile-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: #111827;
  font: inherit;
}

.start-profile-field input:focus {
  border-color: #0b78d0;
  outline: 3px solid rgba(11, 120, 208, 0.16);
}

.start-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.start-profile-primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #0b78d0;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.start-profile-primary:hover {
  background: #075ea7;
}

.start-profile-note {
  margin: 10px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.45;
}

.start-profile-style-intro { margin-top: -4px; margin-bottom: 14px; }
.start-profile-style-options { display: grid; gap: 10px; }
.start-profile-style-option {
  display: grid; grid-template-columns: auto 58px minmax(0, 1fr); align-items: center;
  gap: 12px; box-sizing: border-box; min-height: 74px; padding: 10px 12px;
  border: 1px solid #d7e0ea; border-radius: 12px; background: #fff; color: #1f2937;
  cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.start-profile-style-option:hover { border-color: #7fb6df; background: #f8fbff; }
.start-profile-style-option:has(input:checked) { border-color: #0b78d0; box-shadow: 0 0 0 3px rgba(11, 120, 208, .14); }
.start-profile-style-option input { width: 17px; height: 17px; margin: 0; accent-color: #0b78d0; }
.start-profile-style-option input:focus-visible { outline: 3px solid rgba(11, 120, 208, .22); outline-offset: 3px; }
.start-profile-style-option-title, .start-profile-style-option-description { display: block; }
.start-profile-style-option-title { color: inherit; font-size: 14px; font-weight: 700; }
.start-profile-style-option-description { margin-top: 3px; color: #5f6b7a; font-size: 12px; line-height: 1.4; }
.start-profile-style-swatch { width: 58px; height: 42px; border: 1px solid rgba(15, 23, 42, .15); border-radius: 8px; box-sizing: border-box; box-shadow: inset 0 0 0 1px rgba(255,255,255,.36); }
.start-profile-style-swatch.classic { background: linear-gradient(145deg, #f0f0f0 0%, #f7f7f7 54%, #fff 100%); }
.start-profile-style-swatch.blue-green { background: linear-gradient(145deg, #e8f4ff 0%, #f8fbff 54%, #d9f1ec 100%); }
.start-profile-style-swatch.dark-mode { background: linear-gradient(145deg, #020617 0%, #0f172a 52%, #111827 100%); border-color: #334155; }

.start-profile-overlay[data-start-style="dark-mode"] .start-profile-modal { background: #0f172a; color: #f8fafc; box-shadow: 0 24px 70px rgba(0,0,0,.52); }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-header { border-bottom-color: #1e293b; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-lead,
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-note,
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-field,
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-style-option-description { color: #cbd5e1; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-close { background: #1e293b; color: #f8fafc; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-close:hover { background: #334155; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-nav-btn { color: #cbd5e1; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-nav-btn:hover { background: rgba(148, 163, 184, .16); }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-nav-btn.active { background: rgba(96, 165, 250, .22); color: #dbeafe; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-card { border-color: #334155; background: #111827; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-card-title { color: #f8fafc; }
.start-profile-overlay[data-start-style="dark-mode"] input { border-color: #475569; background: #020617; color: #f8fafc; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-field input:focus { border-color: #93c5fd; outline-color: rgba(147,197,253,.24); }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-style-option { border-color: #334155; background: #0b1220; color: #f8fafc; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-style-option:hover { border-color: #60a5fa; background: #111d32; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-style-option:has(input:checked) { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.2); }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-style-option input { accent-color: #60a5fa; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-status { background: #172554; color: #bfdbfe; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-status.is-success { background: #123524; color: #bbf7d0; }
.start-profile-overlay[data-start-style="dark-mode"] .start-profile-status.is-error { background: #451a1a; color: #fecaca; }

body.start-profile-modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .start-profile-layout {
    grid-template-columns: 1fr;
  }
}

.start-rail-btn {
  width: 80px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--start-rail-text, #424242);
  font-size: 12px;
}

.start-rail-btn:hover {
  background: var(--start-rail-hover, #e6e6e6);
}

.start-rail-btn.active {
  background: var(--start-rail-active, #e0e0e0);
  font-weight: 600;
}

.start-rail-icon {
  font-size: 20px;
  line-height: 1;
}

.start-rail-icon svg {
  display: block;
  width: 30px;
  height: 34px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.14));
}

.start-rail-doc .start-rail-icon svg {
  transition: transform 0.12s ease;
}

.start-rail-doc:hover .start-rail-icon svg {
  transform: translateY(-1px) scale(1.05);
}

.start-screen-main {
  flex: 1 1 auto;
  overflow: auto;
  padding: 18px 48px 40px;
}

.start-screen-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.start-screen-skip {
  border: 0;
  background: transparent;
  color: var(--start-accent, #0f6cbd);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}

.start-screen-skip:hover {
  background: var(--start-skip-hover, #eaf3fb);
}

.start-screen-comparison {
  font-weight: 600;
}

/* USC-271 — окреме повноекранне порівняння RED з незалежним браузерним
   PDF-переглядачем. Усередині навмисно немає жодної панелі редакторів. */
.pdf-comparison-screen {
  position: fixed;
  inset: 0;
  z-index: 50010;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  min-width: 720px;
  background: #d8e1ec;
  color: #1f2937;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.pdf-comparison-screen[hidden] {
  display: none;
}

body.pdf-comparison-open {
  overflow: hidden;
}

.pdf-comparison-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-bottom: 1px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.pdf-comparison-button,
.pdf-comparison-arrow {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pdf-comparison-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  white-space: nowrap;
}

.pdf-comparison-folder {
  border-color: #0f6cbd;
  background: #0f6cbd;
  color: #ffffff;
}

.pdf-comparison-button:hover,
.pdf-comparison-arrow:hover:not(:disabled) {
  border-color: #0f6cbd;
  box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.11);
}

.pdf-comparison-folder:hover {
  background: #075e9d;
}

.pdf-comparison-file-picker {
  flex: 1 1 420px;
  min-width: 220px;
  max-width: 640px;
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr);
  align-items: center;
  gap: 8px;
  color: #526273;
  font-size: 12px;
  font-weight: 600;
}

.pdf-comparison-file-picker select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 34px 0 10px;
  background: #ffffff;
  color: #1f2937;
  font: inherit;
  font-size: 13px;
}

.pdf-comparison-navigation {
  flex: 0 0 auto;
  display: flex;
  gap: 5px;
}

.pdf-comparison-arrow {
  width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.pdf-comparison-arrow:disabled {
  opacity: 0.38;
  cursor: default;
}

.pdf-comparison-status {
  flex: 1 1 260px;
  min-width: 120px;
  overflow: hidden;
  color: #526273;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-comparison-status.is-busy::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 2px solid #bdd7ee;
  border-top-color: #0f6cbd;
  border-radius: 50%;
  animation: pdf-comparison-spin 0.75s linear infinite;
}

@keyframes pdf-comparison-spin {
  to { transform: rotate(360deg); }
}

.pdf-comparison-counter {
  flex: 0 0 auto;
  min-width: 92px;
  color: #334155;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pdf-comparison-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2px;
  background: #64748b;
  overflow: hidden;
}

.pdf-comparison-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.pdf-comparison-pane-label {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.pdf-comparison-red-pane {
  background: #eef1f7;
}

.pdf-comparison-red-surface {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 24px 28px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.pdf-comparison-red-surface .pdf-red-pages {
  gap: 20px;
}

.pdf-comparison-browser-pane,
.pdf-comparison-browser-scroller {
  background: #3b3f45;
}

.pdf-comparison-browser-scroller {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.pdf-comparison-folder-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.pdf-comparison-browser-content {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.pdf-comparison-browser-stage {
  position: relative;
  width: 100%;
  min-height: 1px;
  overflow: visible;
  background: #3b3f45;
}

.pdf-comparison-browser-frame {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  min-height: 1px;
  border: 0;
  background: #3b3f45;
  /* Нативний PDF plugin має власний закритий scroll-контекст. Кожен iframe
     показує одну сторінку у фізичному слоті зовнішнього scroll-документа;
     тому колесо справді рухає PDF, а не лише повзунок поруч із ним. */
  pointer-events: none;
}

.pdf-comparison-empty {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgba(238, 241, 247, 0.96);
  color: #607083;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.pdf-comparison-browser-pane .pdf-comparison-empty {
  background: rgba(59, 63, 69, 0.97);
  color: #d8dee6;
}

.pdf-comparison-empty[hidden] {
  display: none;
}

@media (max-width: 980px) {
  .pdf-comparison-toolbar {
    padding-inline: 9px;
  }

  .pdf-comparison-status {
    display: none;
  }
}

.start-screen-heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--start-heading, #333);
  margin: 6px 0 16px;
}

.start-template-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--start-section-border, #e3e3e3);
}

.start-template-card {
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.start-template-preview {
  width: 124px;
  height: 168px;
  border-radius: 6px;
  background: var(--start-preview-bg, #fff);
  border: 1px solid var(--start-preview-border, #d6d6d6);
  box-shadow: var(--start-card-shadow, 0 1px 4px rgba(0, 0, 0, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.start-template-card:hover .start-template-preview {
  border-color: var(--start-accent, #0f6cbd);
  box-shadow: var(--start-preview-hover-shadow, 0 2px 10px rgba(15, 108, 189, 0.25));
}

/* ЗОНА ПЕРЕТЯГУВАННЯ в ряду шаблонів. Вона займає решту ширини рядка —
   як у настільних редакторах, де це велике поле «кинь файл сюди». Кидати
   можна будь-де на екрані; зона потрібна, щоб про це було ВИДНО. */
.start-template-card-drop {
  flex: 1 1 320px;
  min-width: 260px;
  align-self: stretch;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  color: var(--start-muted, #616161);
  border: 1px dashed var(--start-preview-border, #c8c8c8);
  border-radius: 8px;
  transition: border-color .12s, background-color .12s, color .12s;
}

.start-template-card-drop:hover,
.start-template-card-drop.is-over {
  color: var(--start-accent, #0f6cbd);
  border-color: var(--start-accent, #0f6cbd);
  background: var(--start-drop-hover-bg, rgba(15, 108, 189, .06));
}

.start-template-drop-art { display: flex; opacity: .75; }
.start-template-drop-title { font-size: 15px; font-weight: 600; }
.start-template-drop-hint { font-size: 13px; }
.start-template-drop-link { color: var(--start-accent, #0f6cbd); text-decoration: underline; }

/* МОДАЛКА ПЕРЕТЯГУВАННЯ. Лежить над стартовою сторінкою (у якої свій
   контекст накладання, z-index 50000 — див. USC-124), інакше користувач
   тягнув би файл «під» лендінг. */
.file-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--start-drop-scrim, rgba(15, 23, 42, .45));
  backdrop-filter: blur(2px);
}

.file-drop-overlay[hidden] { display: none; }

.file-drop-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(560px, 92vw);
  padding: 44px 32px;
  text-align: center;
  color: var(--start-text, #1f1f1f);
  background: var(--start-bg, #fff);
  border: 2px dashed var(--start-accent, #0f6cbd);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .28);
  pointer-events: none;               /* кидати можна в будь-яку точку екрана */
}

.file-drop-art { color: var(--start-accent, #0f6cbd); opacity: .9; }
.file-drop-title { margin: 0; font-size: 21px; font-weight: 600; }
.file-drop-hint { margin: 0; font-size: 14px; color: var(--start-muted, #616161); }

/* Стан «формат не підтримується»: та сама модалка, інший колір і кнопка,
   бо відповідь має лишитися на екрані, доки її не прочитають. */
.file-drop-overlay.is-error .file-drop-modal {
  border-color: var(--start-danger, #c5221f);
  border-style: solid;
  pointer-events: auto;
}

.file-drop-overlay.is-error .file-drop-art,
.file-drop-overlay.is-error .file-drop-title { color: var(--start-danger, #c5221f); }

.file-drop-close {
  margin-top: 8px;
  padding: 8px 18px;
  font: inherit;
  color: #fff;
  background: var(--start-accent, #0f6cbd);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  pointer-events: auto;
}

.file-drop-close[hidden] { display: none; }

.start-template-blank.selected {
  outline: 2px solid var(--start-accent, #0f6cbd);
  outline-offset: 2px;
}

.start-template-name {
  font-size: 14px;
  color: var(--start-template-name, #333);
}

.start-template-name-selected {
  background: var(--start-template-selected-bg, #0f6cbd);
  color: var(--start-template-selected-text, #fff);
  padding: 2px 10px;
  border-radius: 4px;
}

.start-template-sheet {
  background: var(--start-sheet-bg, #f4faf4);
}

.start-template-grid {
  width: 84px;
  height: 110px;
  background:
    linear-gradient(var(--start-sheet-grid, #dbe8db) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, var(--start-sheet-grid, #dbe8db) 1px, transparent 1px) 0 0 / 28px 100%;
  border: 1px solid var(--start-sheet-border, #c7dcc7);
}

.start-template-card-stream {
  min-width: 184px;
}

.start-template-stream {
  width: 158px;
  height: 168px;
  border-color: var(--start-accent, #0f6cbd);
  background: var(--start-stream-bg, linear-gradient(145deg, #e8f4ff 0%, #f8fbff 54%, #d9f1ec 100%));
  box-shadow: var(--start-stream-shadow, 0 5px 18px rgba(15, 108, 189, 0.18));
  flex-direction: column;
  gap: 14px;
}

.start-template-stream-lines {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--start-stream-line-bg, #0f6cbd);
  color: var(--start-stream-line-text, #fff);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--start-stream-line-shadow, 0 4px 10px rgba(15, 108, 189, 0.26));
}

.start-template-stream-files {
  color: var(--start-stream-files, #185b86);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.start-template-name-stream {
  color: var(--start-accent-strong, #075e9d);
  font-weight: 700;
}

/* ===========================================================================
   File Stream Viewer — isolated multi-format preview mode
   =========================================================================== */

.file-stream-viewer[hidden] {
  display: none !important;
}

.file-stream-viewer {
  position: fixed;
  inset: 0;
  z-index: 40000;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #eef2f7;
  color: #1f2937;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.file-stream-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid #d9e1ea;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.file-stream-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.file-stream-title {
  color: #075e9d;
  font-size: 17px;
  white-space: nowrap;
}

.file-stream-active-name {
  min-width: 0;
  overflow: hidden;
  color: #52606d;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-stream-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.file-stream-icon-btn,
.file-stream-control-btn,
.file-stream-zoom-label,
.file-stream-primary-btn,
.file-stream-close-btn {
  min-height: 34px;
  border: 1px solid #c8d5e2;
  border-radius: 7px;
  padding: 6px 10px;
  background: #fff;
  color: #29465b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.file-stream-icon-btn {
  min-width: 34px;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
}

.file-stream-zoom-label {
  min-width: 58px;
  cursor: pointer;
}

.file-stream-icon-btn:hover,
.file-stream-control-btn:hover,
.file-stream-zoom-label:hover,
.file-stream-close-btn:hover {
  border-color: #69a8d7;
  background: #eff8ff;
}

.file-stream-primary-btn {
  border-color: #0f6cbd;
  background: #0f6cbd;
  color: #fff;
  font-weight: 700;
}

.file-stream-primary-btn:hover:not(:disabled) {
  background: #075e9d;
}

.file-stream-primary-btn:disabled {
  cursor: not-allowed;
  border-color: #cad3dc;
  background: #edf1f5;
  color: #7b8794;
}

.file-stream-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}

.file-stream-viewer.is-sidebar-collapsed .file-stream-body {
  grid-template-columns: 0 minmax(0, 1fr);
}

.file-stream-sidebar {
  min-width: 0;
  overflow: auto;
  background: #f9fbfd;
  border-right: 1px solid #d9e1ea;
}

.file-stream-viewer.is-sidebar-collapsed .file-stream-sidebar {
  overflow: hidden;
  border-right: 0;
}

.file-stream-sidebar-list {
  min-width: 220px;
  padding: 10px;
}

.file-stream-file-section {
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
}

.file-stream-file-section.is-active {
  border-color: #9dcaf0;
  background: #edf7ff;
}

.file-stream-file-section.is-unavailable {
  opacity: 0.68;
}

.file-stream-file-row {
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.file-stream-expand-btn {
  flex: 0 0 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4d6375;
  cursor: pointer;
  font-size: 18px;
}

.file-stream-expand-btn:hover {
  background: #dceefb;
}

.file-stream-file-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 0;
  border-radius: 7px;
  padding: 8px 8px 8px 4px;
  background: transparent;
  color: #213547;
  cursor: pointer;
  text-align: left;
}

.file-stream-file-btn:hover {
  background: rgba(160, 207, 243, 0.26);
}

.file-stream-file-name,
.file-stream-file-meta,
.file-stream-entry-error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-stream-file-name {
  font-size: 13px;
  font-weight: 700;
}

.file-stream-file-meta {
  color: #66798a;
  font-size: 11px;
}

.file-stream-unit-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 6px 8px 38px;
}

.file-stream-unit-btn {
  border: 0;
  border-radius: 6px;
  padding: 6px 8px;
  background: transparent;
  color: #4c6173;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.file-stream-unit-btn:hover,
.file-stream-unit-btn.is-active {
  background: #d9efff;
  color: #075e9d;
}

.file-stream-entry-error {
  margin: 2px 10px 9px 38px;
  color: #9f3a38;
  font-size: 11px;
}

.file-stream-content {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #eef2f7;
}

.file-stream-status {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 7px 18px;
  color: #617182;
  font-size: 12px;
}

.file-stream-viewport {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.file-stream-empty-state {
  max-width: 560px;
  margin: 48px auto;
  padding: 18px 20px;
  border: 1px solid #f2c8c7;
  border-radius: 10px;
  background: #fff7f6;
  color: #8b3130;
  font-size: 14px;
  line-height: 1.5;
}

.file-stream-pdf-surface {
  height: 100%;
  padding-top: 20px;
}

.file-stream-docx-preview,
.file-stream-xlsx-preview,
.file-stream-text-surface,
.file-stream-image-surface {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.file-stream-docx-preview {
  --ooxml-workspace-bg: #eef2f7;
  --ooxml-workspace-border: 0;
}

.file-stream-docx-preview .ooxml-editor-shell,
.file-stream-docx-preview .ooxml-surface {
  min-height: 100%;
}

.file-stream-docx-preview .ooxml-surface {
  padding: 24px;
  cursor: default;
}

.file-stream-xlsx-preview {
  background: #e5efe5;
}

.file-stream-xlsx-preview .green-editor-root,
.file-stream-xlsx-preview .green-editor-shell {
  min-height: 100%;
}

.file-stream-green-preview .green-cell {
  cursor: default;
}

.file-stream-text-surface {
  box-sizing: border-box;
  padding: 24px;
  background: #fff;
}

.file-stream-text-content {
  width: max-content;
  min-width: 100%;
  margin: 0;
  color: #1f2937;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.file-stream-image-surface {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px;
  box-sizing: border-box;
  background: repeating-conic-gradient(#f4f6f8 0 25%, #e7ecf0 0 50%) 50% / 24px 24px;
}

.file-stream-image-content {
  display: block;
  max-width: none;
  height: auto;
  box-shadow: 0 5px 22px rgba(15, 23, 42, 0.24);
}

.file-stream-footer {
  flex: 0 0 auto;
  padding: 7px 18px;
  border-top: 1px solid #d9e1ea;
  background: #fff;
  color: #718096;
  font-size: 11px;
}

@media (max-width: 880px) {
  .file-stream-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-stream-controls {
    justify-content: flex-start;
  }

  .file-stream-body {
    grid-template-columns: minmax(190px, 38vw) minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .file-stream-header {
    padding: 9px 10px;
  }

  .file-stream-controls {
    gap: 5px;
  }

  .file-stream-control-btn {
    display: none;
  }

  .file-stream-primary-btn,
  .file-stream-close-btn {
    font-size: 12px;
    padding-inline: 8px;
  }

  .file-stream-body {
    grid-template-columns: minmax(150px, 47vw) minmax(0, 1fr);
  }

  .file-stream-sidebar-list {
    min-width: 150px;
  }
}

.start-screen-section {
  margin-top: 22px;
}

.start-recents-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.start-recents-tab {
  border: 0;
  background: transparent;
  font-size: 15px;
  padding: 7px 16px;
  border-radius: 18px;
  cursor: pointer;
  color: var(--start-rail-text, #424242);
}

.start-recents-tab.active {
  background: var(--start-template-selected-bg, #0f6cbd);
  color: var(--start-template-selected-text, #fff);
  font-weight: 600;
}

.start-recents-tab:not(.active):hover {
  background: var(--start-rail-hover, #e6e6e6);
}

.start-recents-header {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--start-section-border, #e3e3e3);
  color: var(--start-muted, #616161);
  font-size: 13px;
}

.start-recents-list {
  display: flex;
  flex-direction: column;
}

.start-recent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--start-section-border, #ececec);
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.start-recent-row:hover {
  background: var(--start-recent-hover, #eef4fb);
}

.start-recent-icon {
  flex: 0 0 34px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: #2b579a;
}

.start-recent-icon.green {
  background: #217346;
}

.start-recent-icon.red {
  background: #c23b2e;
  font-size: 12px;
}

.start-recent-icon.purple {
  background: #7b2cbf;
}

.start-recent-icon.orange {
  background: #d96c0b;
  font-size: 11px;
}

.start-recent-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.start-recent-name {
  font-size: 15px;
  color: var(--start-text, #242424);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-recent-place {
  font-size: 12.5px;
  color: var(--start-muted, #707070);
  margin-top: 2px;
}

.start-recent-date {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--start-muted, #616161);
  text-align: right;
  min-width: 120px;
}

.start-recents-empty {
  padding: 28px 14px;
  color: var(--start-muted, #707070);
  font-size: 14px;
}

.start-recents-more-btn {
  display: block;
  margin: 16px auto 0;
  padding: 8px 18px;
  border: 1px solid var(--start-section-border, #d6d6d6);
  border-radius: 18px;
  background: transparent;
  color: var(--start-rail-text, #424242);
  font: 600 14px/1.2 Arial, sans-serif;
  cursor: pointer;
}

.start-recents-more-btn:hover {
  background: var(--start-rail-hover, #e6e6e6);
}

.start-recents-more-btn:focus-visible {
  outline: 2px solid var(--start-template-selected-bg, #0f6cbd);
  outline-offset: 2px;
}

.start-recents-more-btn[hidden] {
  display: none;
}

/* ===========================================================================
   Нижню горизонтальну панель форматування прибрано: всі операції з текстом
   виконуються через бічні панелі-модалки (Панель редагування тексту,
   Палітра відтінків тощо). Елементи лишаються в DOM, бо JS читає/пише
   значення (fontSizeInput, індикатори) — ховаємо лише візуально.
   =========================================================================== */
.toolbar.toolbar-bottom {
  display: none !important;
}

/* ==========================================================================
   BLUE experimental Ribbon — an isolated command surface. It never replaces
   the legacy top bar or side modals and is only mounted in BLUE mode.
   ========================================================================== */

.blue-ribbon-toggle-btn {
  color: #0f5eaa;
  border-radius: 6px;
}

.blue-ribbon-toggle-btn.is-active {
  color: #fff;
  background: #1267b0;
  border-color: #0c5798;
}

.blue-ribbon-toggle-icon {
  font-size: 19px;
  line-height: 1;
}

.blue-editor-ribbon {
  --blue-ribbon-accent: #1267b0;
  --blue-ribbon-border: #d5d9df;
  --blue-ribbon-hover: #edf5fc;
  --blue-ribbon-muted: #66717d;
  position: relative;
  z-index: 990;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  color: #1f252b;
  background: #fff;
  border-bottom: 1px solid #c9cdd3;
  box-shadow: 0 2px 5px rgba(32, 44, 58, 0.08);
  font-family: Arial, sans-serif;
  user-select: none;
}

.blue-editor-ribbon[hidden] {
  display: none !important;
}

.blue-ribbon-tabs {
  display: flex;
  align-items: end;
  gap: 1px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--blue-ribbon-border);
  background: #fbfbfc;
}

.blue-ribbon-tab {
  position: relative;
  flex: 0 0 auto;
  height: 35px;
  padding: 0 13px;
  border: 0;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: #30363c;
  font: 13px/1 Arial, sans-serif;
  cursor: pointer;
}

.blue-ribbon-tab:hover,
.blue-ribbon-tab:focus-visible {
  background: #eef3f8;
  outline: none;
}

.blue-ribbon-tab[aria-selected="true"],
.blue-ribbon-tab.is-active {
  color: #0b5a9e;
  font-weight: 700;
  background: #fff;
}

.blue-ribbon-tab[aria-selected="true"]::after,
.blue-ribbon-tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue-ribbon-accent);
}

.blue-ribbon-panels,
.blue-ribbon-panel {
  min-width: 0;
}

.blue-ribbon-panel[hidden] {
  display: none !important;
}

.blue-ribbon-groups {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  height: 112px;
  padding: 5px 7px 3px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.blue-ribbon-group {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 17px;
  flex: 0 0 auto;
  min-width: 62px;
  max-width: 680px;
  padding: 0 7px;
  scroll-snap-align: start;
}

.blue-ribbon-group::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 0;
  bottom: 4px;
  width: 1px;
  background: #d9dde2;
}

.blue-ribbon-group:last-child::after {
  display: none;
}

.blue-ribbon-group-commands {
  display: flex;
  align-content: flex-start;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
}

.blue-ribbon-group-label {
  align-self: end;
  min-width: 0;
  overflow: hidden;
  color: var(--blue-ribbon-muted);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blue-ribbon-command,
.blue-ribbon-color-field,
.blue-ribbon-field {
  min-width: 34px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #222a31;
  font: 12px/1.15 Arial, sans-serif;
}

.blue-ribbon-command {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 6px;
  cursor: pointer;
}

.blue-ribbon-command:not(.is-large):not(.blue-ribbon-gallery-item):not(.blue-ribbon-menu-item) {
  height: 31px;
  align-self: start;
  flex-direction: row;
  padding: 3px 6px;
}

.blue-ribbon-command.is-large {
  width: 64px;
  height: 82px;
  white-space: normal;
  text-align: center;
}

.blue-ribbon-command:hover:not(:disabled),
.blue-ribbon-command:focus-visible,
.blue-ribbon-color-field:hover,
.blue-ribbon-field:hover,
.blue-ribbon-overflow-trigger:hover {
  background: var(--blue-ribbon-hover);
  border-color: #b9d4ec;
  outline: none;
}

.blue-ribbon-command.is-active,
.blue-ribbon-command[aria-pressed="true"] {
  color: #064c87;
  background: #dcecf9;
  border-color: #8eb9dc;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.blue-ribbon-command:disabled,
.blue-ribbon-select:disabled,
.blue-ribbon-input:disabled,
.blue-ribbon-color-input:disabled {
  color: #969da4;
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.56;
}

.blue-ribbon-command[aria-busy="true"] {
  cursor: progress;
  opacity: 0.65;
}

.blue-ribbon-command-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 20px;
  min-height: 20px;
  color: currentColor;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.blue-ribbon-command.is-large .blue-ribbon-command-icon {
  min-width: 32px;
  min-height: 34px;
  font-size: 25px;
}

.blue-ribbon-command-label {
  display: block;
  max-width: 96px;
  overflow: hidden;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blue-ribbon-command.is-large .blue-ribbon-command-label {
  white-space: normal;
}

.blue-ribbon-field {
  display: grid;
  grid-template-columns: minmax(108px, 1fr);
  gap: 1px;
  align-self: start;
  padding: 2px 3px;
}

.blue-ribbon-number-field {
  grid-template-columns: 58px;
}

.blue-ribbon-field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.blue-ribbon-select,
.blue-ribbon-input {
  height: 25px;
  min-width: 0;
  border: 1px solid #b9bec5;
  border-radius: 3px;
  background: #fff;
  color: #20262c;
  font: 12px Arial, sans-serif;
}

.blue-ribbon-select {
  width: 128px;
  padding: 0 22px 0 6px;
}

.blue-ribbon-input {
  width: 56px;
  padding: 0 4px;
}

.blue-ribbon-color-field {
  position: relative;
  display: inline-grid;
  grid-template-columns: 22px;
  grid-template-rows: 20px 7px;
  place-items: center;
  align-self: start;
  width: 35px;
  height: 31px;
  padding: 1px 4px;
  cursor: pointer;
}

.blue-ribbon-color-icon {
  grid-row: 1;
  font-size: 17px;
  font-weight: 700;
}

.blue-ribbon-color-input {
  grid-row: 2;
  width: 24px;
  height: 6px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.blue-ribbon-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.blue-ribbon-color-input::-webkit-color-swatch {
  border: 0;
}

.blue-ribbon-color-field > .blue-ribbon-command-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.blue-ribbon-dropdown,
.blue-ribbon-group-overflow {
  position: relative;
  align-self: start;
}

.blue-ribbon-dropdown > summary,
.blue-ribbon-group-overflow > summary {
  list-style: none;
}

.blue-ribbon-dropdown > summary::-webkit-details-marker,
.blue-ribbon-group-overflow > summary::-webkit-details-marker {
  display: none;
}

.blue-ribbon-dropdown > summary::after {
  content: "⌄";
  margin-left: 2px;
  color: #67727d;
  font-size: 9px;
}

.blue-ribbon-menu {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 1100;
  display: grid;
  min-width: 186px;
  max-height: 360px;
  padding: 5px;
  overflow: auto;
  border: 1px solid #c7cbd0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 43, 54, 0.2);
}

.blue-ribbon-menu-item,
.blue-ribbon-menu .blue-ribbon-field,
.blue-ribbon-menu .blue-ribbon-color-field {
  width: 100%;
}

.blue-ribbon-menu-item.blue-ribbon-command {
  justify-content: flex-start;
  height: 32px;
  flex-direction: row;
  text-align: left;
}

.blue-ribbon-menu-item .blue-ribbon-command-label {
  max-width: none;
}

.blue-ribbon-gallery {
  display: grid;
  grid-template-columns: repeat(2, 82px);
  grid-auto-rows: 37px;
  gap: 2px;
  align-self: start;
}

.blue-ribbon-gallery-item.blue-ribbon-command {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  width: 82px;
  height: 37px;
  padding: 3px 5px;
  text-align: left;
}

.blue-ribbon-gallery-item .blue-ribbon-command-icon {
  font-family: Georgia, serif;
}

.blue-ribbon-gallery-item .blue-ribbon-command-label {
  max-width: 49px;
  font-size: 10px;
}

.blue-ribbon-group-overflow {
  display: none;
}

.blue-ribbon-overflow-trigger {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #29323a;
  font-size: 20px;
  cursor: pointer;
}

.blue-ribbon-overflow-menu {
  right: 0;
  left: auto;
}

.blue-editor-ribbon[data-compact="true"] .blue-ribbon-secondary-control {
  display: none;
}

.blue-editor-ribbon[data-compact="true"] .blue-ribbon-group-overflow {
  display: block;
}

.blue-editor-ribbon[data-compact="true"] .blue-ribbon-command.is-compact .blue-ribbon-command-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 760px) {
  .blue-ribbon-tabs {
    padding-inline: 4px;
  }

  .blue-ribbon-tab {
    padding-inline: 9px;
  }

  .blue-ribbon-groups {
    height: 102px;
    padding-inline: 3px;
  }

  .blue-ribbon-group {
    padding-inline: 5px;
  }

  .blue-ribbon-group-label {
    font-size: 9px;
  }
}

.red-pdf-morphological-overlay {
  mix-blend-mode: multiply;
  image-rendering: auto;
}

.red-pdf-morphological-legend {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  user-select: none;
}

.red-ocr-word-gap-overlay {
  position: absolute;
  pointer-events: none;
  overflow: visible;
}

.red-ocr-word-box,
.red-ocr-word-gap-box {
  vector-effect: non-scaling-stroke;
}

.red-ocr-word-gap-box[data-word-gap-type="large-blank-gap"] {
  stroke-dasharray: 4 3;
}

.red-ocr-word-gap-label {
  user-select: none;
}

.red-ocr-legacy-compat {
  display: none !important;
}






/* ===================== Сторінка помилки (Oops) ========================== */
.oops-screen {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--oops-bg, #eef2f8);
}
.oops-screen[hidden] { display: none; }
.oops-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  background: var(--oops-card-bg, #ffffff);
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.oops-art {
  width: 240px;
  max-width: 80%;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}
.oops-title {
  margin: 0 0 10px;
  font: 600 22px/1.3 Arial, sans-serif;
  color: var(--oops-title, #1d2430);
}
.oops-text {
  margin: 0 0 22px;
  font: 400 15px/1.55 Arial, sans-serif;
  color: var(--oops-text, #57606a);
}
.oops-actions { display: flex; gap: 12px; justify-content: center; }
.oops-btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 22px;
  font: 600 15px/1 Arial, sans-serif;
  cursor: pointer;
  transition: filter .12s, background-color .12s;
}
.oops-btn-primary { background: var(--oops-btn, #4a90d9); color: #fff; }
.oops-btn-primary:hover { filter: brightness(1.06); }
/* ===================== /Сторінка помилки (Oops) ========================= */

/* ===================== Режим OCR (перемикач) ============================ */
/* Лише власне OCR-команди залежать від «Режиму OCR». Перетворення PDF у
   DOCX/PPTX має окремий data-red-conversion-action і завжди лишається на
   верхній панелі: конвертер читає структуру ISO 32000-1, а не запускає OCR. */
.pdf-editor-toolbar [data-red-ocr-action] { display: none; }
.editor-shell.ocr-mode .pdf-editor-toolbar [data-red-ocr-action] {
  display: inline-flex;
}

/* Перемикач у рядку з назвою файлу (не в панелі інструментів) */
.pdf-filebar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.pdf-page-screenshot-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(74, 144, 217, 0.38);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: #4a90d9;
  cursor: pointer;
  user-select: none;
  transition:
    background-color .15s,
    border-color .15s,
    box-shadow .15s,
    transform .08s;
}

.pdf-page-screenshot-btn:hover {
  background: #ffffff;
  border-color: rgba(74, 144, 217, 0.72);
  box-shadow: 0 1px 4px rgba(74, 144, 217, 0.22);
}

.pdf-page-screenshot-btn:active {
  transform: translateY(1px);
}

.pdf-page-screenshot-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.pdf-page-screenshot-icon {
  width: 19px;
  height: 19px;
  display: block;
  color: currentColor;
  flex: 0 0 auto;
  pointer-events: none;
}

.pdf-page-screenshot-icon-shape {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 88;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

.pdf-word-o-debug-btn {
  color: #ea580c;
  border-color: rgba(234, 88, 12, 0.38);
}

.pdf-word-o-debug-btn:hover {
  border-color: rgba(234, 88, 12, 0.72);
  box-shadow: 0 1px 4px rgba(234, 88, 12, 0.22);
}

.pdf-word-o-debug-icon {
  font: 800 13px/1 Arial, sans-serif;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.pdf-ocr-mode-toggle {
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font: 600 13px/1 Arial, sans-serif;
  color: var(--oops-text, #57606a);
  white-space: nowrap;
}
.pdf-ocr-mode-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.pdf-ocr-mode-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: #c7ced9;
  transition: background-color .15s;
  flex: 0 0 auto;
}
.pdf-ocr-mode-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform .15s;
}
.pdf-ocr-mode-toggle input:checked + .pdf-ocr-mode-track { background: #4a90d9; }
.pdf-ocr-mode-toggle input:checked + .pdf-ocr-mode-track .pdf-ocr-mode-thumb { transform: translateX(16px); }
.pdf-ocr-mode-toggle input:focus-visible + .pdf-ocr-mode-track { outline: 2px solid #4a90d9; outline-offset: 2px; }
.editor-shell.ocr-mode .pdf-ocr-mode-label { color: #4a90d9; }
/* ===================== /Режим OCR ======================================= */

.red-ocr-word-o-review-overlay {
  position: absolute;
  inset: 0;
  z-index: 54;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.red-ocr-word-o-review-accepted {
  fill: rgba(59, 130, 246, 0.10);
  stroke: rgba(37, 99, 235, 0.92);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.red-ocr-word-o-review-candidate {
  fill: rgba(249, 115, 22, 0.13);
  stroke: rgba(234, 88, 12, 0.95);
  stroke-width: 1.6;
  stroke-dasharray: 4 2;
  vector-effect: non-scaling-stroke;
}

.red-ocr-word-o-review-label {
  fill: rgba(154, 52, 18, 0.98);
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 3px;
  paint-order: stroke;
  font: 700 10px Arial, sans-serif;
}

.pdf-word-o-debug-btn[data-word-o-debug-running="true"] {
  opacity: 0.72;
  cursor: progress;
}

.pdf-word-o-debug-btn[data-word-o-debug-running="true"] .pdf-word-o-debug-icon {
  animation: redWordODebugPulse 0.9s ease-in-out infinite;
}

@keyframes redWordODebugPulse {
  0% {
    transform: scale(1);
    opacity: 0.65;
  }

  50% {
    transform: scale(1.12);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0.65;
  }
}

/* ===================== OCR O/0 human review panel ======================= */
.pdf-word-o-review-panel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border: 1px solid rgba(74, 144, 217, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.54);
}

.pdf-word-o-review-panel .pdf-page-screenshot-btn {
  width: 30px;
  height: 30px;
}

.pdf-word-o-review-good-btn {
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.42);
}

.pdf-word-o-review-good-btn:hover,
.pdf-word-o-review-good-btn.is-active {
  border-color: rgba(22, 163, 74, 0.82);
  box-shadow: 0 1px 5px rgba(22, 163, 74, 0.28);
}

.pdf-word-o-review-bad-btn {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.42);
}

.pdf-word-o-review-bad-btn:hover,
.pdf-word-o-review-bad-btn.is-active {
  border-color: rgba(220, 38, 38, 0.82);
  box-shadow: 0 1px 5px rgba(220, 38, 38, 0.28);
}

.pdf-word-o-review-dot {
  width: 13px;
  height: 13px;
  display: block;
  border-radius: 50%;
  background: currentColor;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

.pdf-word-o-manual-mark-btn {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.42);
}

.pdf-word-o-manual-mark-btn:hover,
.pdf-word-o-manual-mark-btn.is-active {
  border-color: rgba(124, 58, 237, 0.82);
  box-shadow: 0 1px 5px rgba(124, 58, 237, 0.25);
}

.pdf-word-o-manual-mark-icon {
  font: 800 16px/1 Arial, sans-serif;
  pointer-events: none;
}

.pdf-word-o-report-btn {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.42);
}

.pdf-word-o-report-btn:hover {
  border-color: rgba(37, 99, 235, 0.82);
  box-shadow: 0 1px 5px rgba(37, 99, 235, 0.25);
}

.pdf-word-o-report-icon {
  font: 800 16px/1 Arial, sans-serif;
  pointer-events: none;
}

.red-ocr-word-o-review-overlay {
  pointer-events: auto;
}

.red-ocr-word-o-review-hit {
  cursor: pointer;
  pointer-events: auto;
}

.red-ocr-word-o-review-confirmed {
  fill: rgba(22, 163, 74, 0.18) !important;
  stroke: rgba(22, 163, 74, 0.98) !important;
  stroke-dasharray: none !important;
  stroke-width: 2.2 !important;
}

.red-ocr-word-o-review-rejected {
  fill: rgba(220, 38, 38, 0.16) !important;
  stroke: rgba(220, 38, 38, 0.98) !important;
  stroke-dasharray: 3 2 !important;
  stroke-width: 2.4 !important;
}

.red-ocr-word-o-review-selection {
  fill: rgba(124, 58, 237, 0.12);
  stroke: rgba(124, 58, 237, 0.95);
  stroke-width: 1.8;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.red-ocr-word-o-review-manual {
  fill: rgba(124, 58, 237, 0.13);
  stroke: rgba(124, 58, 237, 0.96);
  stroke-width: 2;
  stroke-dasharray: 6 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.red-ocr-word-o-review-manual-label {
  fill: rgba(91, 33, 182, 0.98);
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 3px;
  paint-order: stroke;
  font: 700 11px Arial, sans-serif;
  pointer-events: none;
}

.red-ocr-word-o-manual-panel {
  position: fixed;
  z-index: 100000;
  width: 248px;
  padding: 10px;
  border: 1px solid rgba(124, 58, 237, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  color: #1f2937;
  font: 13px/1.35 Arial, sans-serif;
}

.red-ocr-word-o-manual-title {
  margin-bottom: 8px;
  font-weight: 800;
  color: #5b21b6;
}

.red-ocr-word-o-manual-field {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.red-ocr-word-o-manual-field span {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
}

.red-ocr-word-o-manual-field input,
.red-ocr-word-o-manual-field select {
  width: 100%;
  min-height: 28px;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  padding: 4px 7px;
  font: 13px Arial, sans-serif;
}

.red-ocr-word-o-manual-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.red-ocr-word-o-manual-actions button {
  min-height: 28px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #ffffff;
  cursor: pointer;
  font: 700 12px Arial, sans-serif;
}

.red-ocr-word-o-manual-actions button[data-word-o-manual-save] {
  border-color: rgba(124, 58, 237, 0.50);
  background: #7c3aed;
  color: #ffffff;
}
/* ===================== /OCR O/0 human review panel ====================== */


/* === OCR: вкладки панелі розпізнавання + DOCX-прев'ю (USC-072) === */
.pdf-recognition-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  background: #f7f7f8;
}

.pdf-recognition-tab {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  background: #fff;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.pdf-recognition-tab.is-active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.pdf-recognition-tab-save {
  margin-left: auto;
}

.pdf-recognition-docx-pane {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.pdf-recognition-docx-preview {
  flex: 1 1 auto;
  overflow: auto;
  background: #e9e9ec;
  zoom: 0.55;
}

.pdf-recognition-docx-empty {
  padding: 24px;
  color: #555;
  font-size: 14px;
  zoom: 1.8;
}

/* Стан «відкриваємо файл» на стартовому екрані: лендінг лишається на місці,
   доки не готовий ПОТРІБНИЙ редактор (PDF → RED, XLSX → GREEN, PPTX → PURPLE,
   DOCX → BLUE), тож чужий редактор не «блимає» на великих файлах. */
.start-screen-busy {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.88);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  z-index: 30;
}

.start-screen-busy[hidden] {
  display: none;
}

.start-screen-busy-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: start-screen-busy-spin 0.8s linear infinite;
}

@keyframes start-screen-busy-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .start-screen-busy-spinner { animation: none; }
}

/* Другий рядок картки «Останні»: звідки саме відкриється документ. */
.start-recent-path {
  display: block;
  font-size: 12px;
  color: var(--start-muted, #616161);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Вибір «чернетка чи оригінал» при відкритті файлу з диска. */
/* z-index МАЄ бути вищим за стартову сторінку (.start-screen = 50000): цей
   діалог відкривається САМЕ з лендінгу, і з нижчим шаром він опинявся ПІД ним —
   користувач бачив лише спінер «Відкриваємо документ…», а обіцянка вибору
   чекала на клік, який неможливо було зробити (документ не відкривався). */
.draft-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 51500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 20, 0.45);
}

.draft-choice-modal {
  width: min(520px, calc(100vw - 32px));
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  font-size: 14px;
  color: #242424;
}

.draft-choice-title { margin: 0 0 10px; font-size: 18px; }
.draft-choice-text { margin: 0 0 18px; line-height: 1.5; }
.draft-choice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.draft-choice-actions button {
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
}

.draft-choice-primary { background: #0f6cbd; color: #fff; }
.draft-choice-secondary { background: #fff; border-color: #d6d6d6; color: #242424; }
.draft-choice-ghost { background: transparent; color: #616161; }

/* Вкладка профілю «Файли й доступ». */
.start-profile-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--start-section-border, #e3e3e3);
  border-radius: 10px;
  cursor: pointer;
}

.start-profile-toggle input { margin-top: 3px; width: 18px; height: 18px; }
.start-profile-toggle-title { display: block; font-weight: 600; }
.start-profile-toggle-description {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--start-muted, #616161);
}

.start-profile-subtitle { margin: 18px 0 8px; font-size: 14px; }

.file-access-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.file-access-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--start-rail-bg, #f0f0f0);
  font-size: 13px;
}

.file-access-name { font-weight: 600; }
.file-access-state { color: #a05a00; }
.file-access-state.is-granted { color: #1a7f37; }
.file-access-draft { color: var(--start-muted, #616161); }
.file-access-empty { font-size: 13px; color: var(--start-muted, #616161); }

/* Доступ до теки + кнопки дій у списку файлів. */
.file-access-directory {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 14px 0 8px;
}

.file-access-directory-label {
  font-size: 13px;
  color: var(--start-muted, #616161);
}

.file-access-item .file-access-btn {
  margin-left: auto;
  border: 1px solid #d6d6d6;
  background: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.file-access-item .file-access-btn.is-primary {
  background: #0f6cbd;
  border-color: #0f6cbd;
  color: #fff;
}

/* Панель «Таблиця» у модалці формату BLUE. */
.ooxml-table-picker {
  display: grid;
  grid-template-columns: repeat(8, 22px);
  gap: 2px;
  margin: 6px 0 8px;
}

.ooxml-table-cell {
  width: 22px;
  height: 18px;
  border: 1px solid #c9d1d9;
  background: #fff;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}

.ooxml-table-cell.is-hot { background: #cfe4fb; border-color: #0f6cbd; }
.ooxml-table-picker-hint { font-size: 12px; color: #616161; }
.ooxml-table-empty { font-size: 12px; color: #616161; margin: 4px 0 8px; }

.ooxml-table-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.ooxml-table-actions button {
  border: 1px solid #d6d6d6;
  background: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ooxml-table-actions button:hover { background: #f2f7fd; border-color: #0f6cbd; }
/* Дії доступні лише коли курсор у таблиці — приглушені кнопки не клікаються. */
.ooxml-table-actions[data-disabled="true"] { opacity: .5; pointer-events: none; }

/* ── Кнопки «Таблиця» і «Помилки» в панелі ─────────────────────────────── */
.table-modal-icon,
.doc-issues-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.doc-issues-btn { position: relative; }

.doc-issues-btn.has-issues { color: #b3261e; }

.doc-issues-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: #b3261e;
  color: #fff;
  font: 600 10px/15px Arial, sans-serif;
  text-align: center;
}

/* ── Модалка «Помилки в документі» ─────────────────────────────────────── */
/* z-index вищий за стартову сторінку (50000) — модалку можуть відкрити з неї. */
.doc-issues-overlay {
  position: fixed;
  inset: 0;
  z-index: 51500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 20, 0.45);
}

.doc-issues-overlay[hidden] { display: none; }

.doc-issues-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(70vh, 620px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.doc-issues-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e6e6e6;
}

.doc-issues-title { margin: 0; font-size: 16px; font-weight: 600; }

.doc-issues-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #5f6368;
}

.doc-issues-body { padding: 12px 18px 18px; overflow: auto; }

.doc-issue-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.doc-issue-item:last-child { border-bottom: 0; }

.doc-issue-mark { flex: 0 0 auto; font-size: 15px; line-height: 1.4; }

.doc-issue-text { font-size: 14px; line-height: 1.45; color: #202124; }

.doc-issue-detail { margin-top: 3px; font-size: 12.5px; color: #5f6368; }

.doc-issues-empty { padding: 8px 0; font-size: 14px; color: #5f6368; }

/* --- Локатор перекриття: підсвітка плашки на сторінці з панелі шарів ------ */

.red-overlay-locator {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid #e0353f;
  border-radius: 2px;
  background: rgba(224, 53, 63, 0.18);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 12px rgba(224, 53, 63, 0.55);
}

/* Після кліку маркер коротко «дихає», щоб око знайшло його на аркуші. */
.red-overlay-locator.is-flash {
  animation: red-overlay-flash 0.62s ease-in-out 0s 4;
}

@keyframes red-overlay-flash {
  0%, 100% { background: rgba(224, 53, 63, 0.14); border-color: #e0353f; }
  50% { background: rgba(224, 53, 63, 0.42); border-color: #ff6b73; }
}

@media (prefers-reduced-motion: reduce) {
  .red-overlay-locator.is-flash { animation: none; }
}

/* Рядок перекриття клікабельний: ведемо себе як кнопка. */
.red-layer-row.is-locatable { cursor: pointer; }
.red-layer-row.is-locatable:hover { background: #eef3fd; }
.red-layer-row.is-locatable:focus-visible {
  outline: 2px solid #1a56b8;
  outline-offset: -2px;
}

/* Вибір кольору плашки-заливки просто в рядку панелі шарів. */
.red-layer-color {
  flex: 0 0 auto;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid #c3ccd9;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.red-layer-color::-webkit-color-swatch-wrapper { padding: 2px; }
.red-layer-color::-webkit-color-swatch { border: 0; border-radius: 3px; }
.red-layer-color:disabled { opacity: 0.45; cursor: default; }

/* Групи «Сторінка N» у панелі шарів: без них список на 300-сторінковому скані
   перетворюється на тисячі рядків суцільною стрічкою. */
.red-layer-page-group {
  border-top: 1px solid #e6eaf2;
}

.red-layer-page-group:first-child { border-top: 0; }

.red-layer-page-group > summary {
  cursor: pointer;
  padding: 7px 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #46506048;
  color: #465060;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.red-layer-page-group > summary::-webkit-details-marker { display: none; }

.red-layer-page-group > summary::before {
  content: '▸';
  font-size: 10px;
  color: #8b93a2;
  transition: transform 0.12s ease;
}

.red-layer-page-group[open] > summary::before { transform: rotate(90deg); }

.red-layer-page-group > summary:hover { background: #eef3fd; border-radius: 6px; }

.red-layer-page-group > summary > span {
  margin-inline-start: auto;
  padding: 1px 8px;
  border-radius: 9px;
  background: #eaeef6;
  font-size: 11px;
  font-weight: 600;
  color: #5b6474;
}

.red-layer-page-group > .red-layer-list { padding-inline-start: 6px; }

/* ═══ ORANGE — перегляд архівів ═══════════════════════════════════════════
   Верхня й нижня панелі спільні з рештою редакторів; тут лише робоча область.
   Ліворуч перелік вмісту, праворуч прев'ю — так само, як у решті системи
   бічна панель тримає навігацію, а центр показує вміст.                     */

.orange-archive-mode #ooxmlEngineHost,
.orange-archive-mode #ooxmlGreenEngineHost,
.orange-archive-mode #ooxmlPurpleEngineHost,
.orange-archive-mode #pdfViewerHost {
  display: none;
}

.orange-archive-mode .orange-archive-host {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.orange-archive-host[hidden] { display: none; }

.oa-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: #f1f4f9;
}

/* ── ліворуч: прев'ю ─────────────────────────────────────────────────────── */
.oa-preview {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.oa-preview-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #e2e6ee;
  background: #fff;
}

.oa-preview-name {
  font-weight: 600;
  font-size: 13px;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oa-preview-meta {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  margin-left: auto;
}

.oa-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.oa-placeholder {
  margin: auto;
  max-width: 420px;
  text-align: center;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.6;
}

.oa-open-btn {
  margin-top: 14px;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: #F97316;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.oa-open-btn:hover { background: #ea6a06; }

.oa-image,
.oa-canvas {
  max-width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.16);
}

.oa-preview-note {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.oa-text {
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #202124;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── праворуч: перелік файлів і тек ──────────────────────────────────────── */
.oa-list {
  flex: 0 0 340px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-right: 1px solid #e2e6ee;
}

.oa-list-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e2e6ee;
}

.oa-list-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oa-list-sub {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: #6b7280;
}

.oa-tree {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 6px 0 12px;
}

.oa-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 12px 5px 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: #202124;
  text-align: left;
  cursor: pointer;
}
.oa-row:hover { background: #f3f6fb; }
.oa-row.is-active { background: #ffe8d4; }
.oa-row.is-dir { font-weight: 600; }

.oa-row-icon {
  flex: 0 0 auto;
  width: 14px;
  color: #F97316;
  text-align: center;
}

.oa-row-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oa-row-size {
  flex: 0 0 auto;
  font-size: 11px;
  color: #9aa0a6;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .oa-body { flex-direction: column; }
  .oa-list { flex: 0 0 45%; border-right: 0; border-bottom: 1px solid #e2e6ee; }
}

/* У режимі архіву лічильники символів і слів не мають сенсу — показуємо
   натомість підсумок по архіву (кількість файлів і виграш від стиснення). */
.editor-shell.orange-archive-mode #documentFooter .footer-item:has(#charCount),
.editor-shell.orange-archive-mode #documentFooter .footer-item:has(#wordCount),
.editor-shell.orange-archive-mode #documentFooter .footer-item:has(#purpleSlideStats) {
  display: none;
}

.editor-shell.orange-archive-mode #orangeArchiveStats {
  display: inline;
  font-variant-numeric: tabular-nums;
}

.oa-error { color: #b3261e; }
.oa-error-why {
  margin-top: 6px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #6b7280;
  word-break: break-word;
}

/* ── Формат фігури (кольорові плашки й написи в BLUE) ─────────────────────
   Те саме плаваюче вікно, що й у зображень, лише предмет інший. */
.blue-shape-format-window {
  position: fixed;
  z-index: 1200;
  width: 300px;
  max-height: 78vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(60, 64, 67, .28);
  font-size: 13px;
}

.blue-shape-format-window[hidden] { display: none; }

.blue-shape-format-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid #e8eaed;
  position: sticky;
  top: 0;
  background: #fff;
}

.blue-shape-format-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
}

.blue-shape-format-close:hover { background: #f1f3f4; }

.blue-shape-section { border-bottom: 1px solid #f1f3f4; }
.blue-shape-section > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 500;
  list-style: none;
}
.blue-shape-section > summary::-webkit-details-marker { display: none; }
.blue-shape-section > summary::before { content: '▸ '; color: #5f6368; }
.blue-shape-section[open] > summary::before { content: '▾ '; }
.blue-shape-section-body { padding: 4px 12px 12px; }

.blue-shape-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.blue-shape-swatch {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(60, 64, 67, .25);
  cursor: pointer;
  padding: 0;
}

.blue-shape-swatch.is-active { box-shadow: 0 0 0 2px #1a73e8; }
.blue-shape-custom input { width: 26px; height: 24px; border: 0; background: none; padding: 0; }
.blue-shape-none {
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
}

.blue-shape-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.blue-shape-field { display: flex; align-items: center; gap: 6px; }
.blue-shape-field span:first-child { flex: 1; color: #5f6368; }
.blue-shape-field input[type="number"] { width: 68px; padding: 3px 6px; border: 1px solid #dadce0; border-radius: 6px; }
.blue-shape-unit { color: #80868b; }

/* Градієнтна заливка фігури (ISO/IEC 29500-1 §20.1.8.33): перемикачі виду
   заливки, смуга перегляду й рядок однієї зупинки `a:gs`. */
.blue-shape-gradient-modes { display: flex; gap: 6px; margin-bottom: 8px; }
.blue-shape-gradient-preview {
  height: 28px; border-radius: 6px; border: 1px solid #d3d8e0; margin-bottom: 8px;
}
.blue-shape-gradient-presets { display: flex; gap: 6px; }
.blue-shape-gradient-preset {
  width: 44px; height: 26px; border-radius: 6px; border: 1px solid #d3d8e0;
  cursor: pointer; padding: 0;
}
.blue-shape-gradient-preset:hover { border-color: #1a73e8; }
.blue-shape-gradient-stop {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap;
}
.blue-shape-gradient-stop input[type="color"] {
  width: 30px; height: 26px; padding: 0; border: 1px solid #d3d8e0; border-radius: 5px;
  background: none; cursor: pointer;
}
.blue-shape-gradient-stop label {
  display: flex; align-items: center; gap: 4px; font-size: 11px; color: #5f6368;
}
.blue-shape-gradient-stop label input { width: 52px; }

.blue-shape-align-row, .blue-shape-order-row { display: flex; gap: 6px; }
.blue-shape-align, .blue-shape-order-row button {
  flex: 1;
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 6px;
  padding: 5px 6px;
  cursor: pointer;
}
.blue-shape-align.is-active { background: #e8f0fe; border-color: #1a73e8; color: #1a73e8; }

.blue-shape-format-window textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px;
  font: inherit;
  resize: vertical;
}

/* У повній оболонці додавання, форматування й упорядкування — розділи ОДНІЄЇ
   прокручуваної панелі. Плаваючий стиль вище зберігається тільки як резерв
   для автономного BLUE-компонента без shell/index.html. */
.ooxml-shape-format-integrated.blue-shape-format-window {
  position: static;
  z-index: auto;
  width: auto;
  max-height: none;
  overflow: visible;
  border: 1px solid #d9e0e8;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  font-size: 12px;
}

.ooxml-shape-format-integrated .blue-shape-format-header { display: none; }
.ooxml-shape-format-integrated > .ooxml-text-format-section-title {
  margin: 0;
  padding: 10px;
  border-bottom: 1px solid #e3e7ec;
  color: #27313c;
}
.ooxml-shape-format-integrated .blue-shape-section:last-child { border-bottom: 0; }
.ooxml-shape-format-integrated .blue-shape-section > summary { padding: 9px 10px; }
.ooxml-shape-format-integrated .blue-shape-section-body { padding: 4px 10px 11px; }
.blue-shape-format-empty {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid #e3e7ec;
  background: #f6f8fa;
  color: #66717e;
  font-size: 11px;
  line-height: 1.4;
}
.blue-shape-format-body.is-inactive .blue-shape-section { opacity: .62; }
.blue-shape-format-body.is-inactive button:disabled,
.blue-shape-format-body.is-inactive input:disabled,
.blue-shape-format-body.is-inactive textarea:disabled {
  cursor: not-allowed;
}

/* Маркери виділення фігури — як у зображень. */
.blue-shape-selection {
  position: absolute;
  display: none;
  pointer-events: none;
  /* Рамка лежить у тілі документа поруч із фігурою, тож їй вистачає низького
     шару: над сторінкою, але під панелями редактора — інакше при
     прокручуванні вона налазила на верхню панель. */
  z-index: 6;
  outline: 1px solid #1a73e8;
}

.blue-shape-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 1px solid #1a73e8;
  border-radius: 2px;
}

.blue-shape-handle[data-blue-shape-handle="nw"] { left: -5px; top: -5px; }
.blue-shape-handle[data-blue-shape-handle="n"] { left: calc(50% - 5px); top: -5px; }
.blue-shape-handle[data-blue-shape-handle="ne"] { right: -5px; top: -5px; }
.blue-shape-handle[data-blue-shape-handle="e"] { right: -5px; top: calc(50% - 5px); }
.blue-shape-handle[data-blue-shape-handle="se"] { right: -5px; bottom: -5px; }
.blue-shape-handle[data-blue-shape-handle="s"] { left: calc(50% - 5px); bottom: -5px; }
.blue-shape-handle[data-blue-shape-handle="sw"] { left: -5px; bottom: -5px; }
.blue-shape-handle[data-blue-shape-handle="w"] { left: -5px; top: calc(50% - 5px); }

/* Межі рамки виділення — мішень для «Формату фігури»: середина лишається
   прозорою, щоб текст усередині напису правився як звичайно. */
.blue-shape-edge {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
}

.blue-shape-edge[data-blue-shape-edge="top"] { left: -4px; right: -4px; top: -4px; height: 8px; }
.blue-shape-edge[data-blue-shape-edge="bottom"] { left: -4px; right: -4px; bottom: -4px; height: 8px; }
.blue-shape-edge[data-blue-shape-edge="left"] { top: -4px; bottom: -4px; left: -4px; width: 8px; }
.blue-shape-edge[data-blue-shape-edge="right"] { top: -4px; bottom: -4px; right: -4px; width: 8px; }
.blue-shape-edge:hover { background: rgba(26, 115, 232, .18); }

/* Маркери розтягування фігури: кожен зі своїм курсором, як у Word. */
.blue-shape-handle { pointer-events: auto; }
.blue-shape-handle[data-blue-shape-handle="nw"],
.blue-shape-handle[data-blue-shape-handle="se"] { cursor: nwse-resize; }
.blue-shape-handle[data-blue-shape-handle="ne"],
.blue-shape-handle[data-blue-shape-handle="sw"] { cursor: nesw-resize; }
.blue-shape-handle[data-blue-shape-handle="n"],
.blue-shape-handle[data-blue-shape-handle="s"] { cursor: ns-resize; }
.blue-shape-handle[data-blue-shape-handle="e"],
.blue-shape-handle[data-blue-shape-handle="w"] { cursor: ew-resize; }

body.blue-shape-resizing { user-select: none; cursor: grabbing; }

/* РУЧКА ПОВОРОТУ стоїть над серединою верхньої сторони — там, де її шукають
   у Word. Вона на 26px вище рамки, щоб не злипатися з верхнім маркером. */
.blue-shape-rotate-handle {
  position: absolute;
  left: calc(50% - 11px);
  top: -30px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: grab;
  color: #1a73e8;
  background: #fff;
  border: 1px solid #1a73e8;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.blue-shape-rotate-handle:hover { background: #e8f0fe; }
body.blue-shape-rotating { user-select: none; cursor: grabbing; }
body.blue-shape-rotating .blue-shape-rotate-handle { cursor: grabbing; }

/* Кут видно ПІД ЧАС повороту: без цього користувач крутить наосліп. */
.blue-shape-rotate-readout {
  position: absolute;
  left: calc(50% - 24px);
  top: -58px;
  min-width: 48px;
  padding: 2px 6px;
  display: none;
  text-align: center;
  font: 600 12px/1.4 system-ui, sans-serif;
  color: #fff;
  background: #1a73e8;
  border-radius: 4px;
  pointer-events: none;
}

.blue-shape-rotate-readout.is-visible { display: block; }

/* Команди повороту у вікні «Формат фігури»: значок + українська назва. */
.blue-shape-rotate-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 8px;
}

.blue-shape-rotate-cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font: 400 13px/1.3 system-ui, sans-serif;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.blue-shape-rotate-cmd:hover { background: rgba(26, 115, 232, .1); }
.blue-shape-rotate-cmd.is-active {
  border-color: #1a73e8;
  background: rgba(26, 115, 232, .14);
}

.blue-shape-rotate-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: #1a73e8;
}

.blue-shape-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.blue-shape-switch {
  width: 38px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #dadce0;
  background: #f1f3f4;
  position: relative;
  cursor: pointer;
  padding: 0;
}

.blue-shape-switch span {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .3);
  transition: left .12s ease;
}

.blue-shape-switch.is-active { background: #1a73e8; border-color: #1a73e8; }
.blue-shape-switch.is-active span { left: 19px; }

/* Виділені клітинки таблиці: прямокутник, як у Word. */
.ooxml-page td.ooxml-cell-selected,
.ooxml-page th.ooxml-cell-selected {
  background-image: linear-gradient(rgba(26, 115, 232, .22), rgba(26, 115, 232, .22));
  outline: 1px solid rgba(26, 115, 232, .5);
  outline-offset: -1px;
}

/* Каретка кінця рядка таблиці — місце праворуч від таблиці, звідки Enter
   додає новий рядок (як у Word). */
.ooxml-row-end-caret {
  position: absolute;
  width: 2px;
  background: #1a73e8;
  animation: ooxml-row-end-blink 1s steps(1) infinite;
  pointer-events: none;
  z-index: 7;
}

@keyframes ooxml-row-end-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ── Панель коментарів (ECMA-376 §17.13.4) ───────────────────────────────── */
.blue-comments-panel {
  position: fixed;
  right: 16px;
  top: var(--side-modal-top, 128px);
  width: 300px;
  max-height: calc(100vh - var(--side-modal-top, 128px) - 24px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(60, 64, 67, .28);
  /* Той самий шар, що й бічні модалки редактора (24000): інакше панель
     ховалася за вікном «Стиль символів», і користувач її не бачив. */
  z-index: 24010;
  font: 13px/1.45 Arial, sans-serif;
}

.blue-comments-panel[hidden] { display: none; }

.blue-comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid #e8eaed;
}

.blue-comments-actions { display: flex; gap: 4px; }
.blue-comments-actions button {
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 6px;
  width: 26px;
  height: 24px;
  cursor: pointer;
  line-height: 1;
}
.blue-comments-actions button:hover { background: #f1f3f4; }

.blue-comments-body { overflow: auto; padding: 8px; }
.blue-comments-empty { color: #5f6368; padding: 16px 8px; text-align: center; }

.blue-comment-card {
  border: 1px solid #e8eaed;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
}
.blue-comment-card:hover { background: #f8f9fa; }

.blue-comment-top { display: flex; align-items: center; gap: 6px; }
.blue-comment-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: #1a73e8; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.blue-comment-author { font-weight: 600; }
.blue-comment-date { color: #80868b; font-size: 11px; margin-left: auto; }
.blue-comment-remove { border: 0; background: transparent; color: #9aa0a6; cursor: pointer; }
.blue-comment-remove:hover { color: #d93025; }

.blue-comment-quote {
  margin: 6px 0 4px;
  padding-left: 8px;
  border-left: 3px solid #fbbc04;
  color: #5f6368;
  font-style: italic;
}
.blue-comment-text { white-space: pre-wrap; }

/* Прокоментований текст на сторінці. */
.ooxml-page .blue-commented {
  background: linear-gradient(rgba(251, 188, 4, .18), rgba(251, 188, 4, .18));
}
.ooxml-page .blue-comment-hit {
  outline: 2px solid rgba(251, 188, 4, .8);
  outline-offset: 2px;
}

/* Якір заякореного об'єкта — як у Word: значок на полі проти абзацу-власника. */
.blue-shape-anchor {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #5f6368;
  cursor: pointer;
  z-index: 8;
  box-shadow: 0 1px 3px rgba(60, 64, 67, .25);
}

.blue-shape-anchor:hover { background: #f1f3f4; color: #1a73e8; }
.blue-shape-anchor.is-locked { color: #1a73e8; border-color: #1a73e8; }
.blue-shape-anchor.is-locked::after {
  content: '';
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a73e8;
}

/* Абзац, до якого прив'язаний вибраний об'єкт. */
.ooxml-page .blue-anchor-owner {
  outline: 1px dashed rgba(26, 115, 232, .5);
  outline-offset: 2px;
}

/* ── Панель шарів BLUE ───────────────────────────────────────────────────── */
.blue-layers-panel {
  position: fixed;
  right: 16px;
  top: var(--side-modal-top, 128px);
  width: 320px;
  max-height: calc(100vh - var(--side-modal-top, 128px) - 24px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(60, 64, 67, .28);
  z-index: 24010;
  font: 13px/1.45 Arial, sans-serif;
}

.blue-layers-panel[hidden] { display: none; }

.blue-layers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid #e8eaed;
}

.blue-layers-head button { border: 0; background: transparent; cursor: pointer; font-size: 14px; color: #5f6368; }
.blue-layers-body { overflow: auto; padding: 8px; }
.blue-layers-empty { color: #5f6368; padding: 16px 8px; text-align: center; }

.blue-layers-group > summary {
  cursor: pointer;
  padding: 6px 4px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.blue-layers-group > summary::-webkit-details-marker { display: none; }
.blue-layers-group > summary::before { content: '▾'; color: #5f6368; }
.blue-layers-group:not([open]) > summary::before { content: '▸'; }
.blue-layers-count {
  margin-left: auto;
  color: #5f6368;
  font-weight: 400;
  background: #f1f3f4;
  border-radius: 10px;
  padding: 0 8px;
}

.blue-layers-group-body { padding: 2px 0 10px; }

.blue-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  margin: 3px 0;
  cursor: pointer;
  border: 1px solid rgba(60, 64, 67, .08);
}
.blue-layer-row:hover { border-color: rgba(26, 115, 232, .5); }
.blue-layer-row.is-text { cursor: default; font-weight: 600; }
.blue-layer-icon { width: 16px; text-align: center; }
.blue-layer-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blue-layer-note { color: #5f6368; font-size: 11px; }
.blue-layer-move { display: flex; gap: 2px; }
.blue-layer-move button {
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 5px;
  width: 22px;
  height: 20px;
  cursor: pointer;
  line-height: 1;
  font-size: 10px;
}
.blue-layer-move button[disabled] { opacity: .35; cursor: default; }

/* Виноски й кінцеві виноски — ISO/IEC 29500-1 §17.11.
   Значок у тексті — верхній індекс; текст виноски стоїть унизу сторінки під
   короткою рискою-роздільником, як його малює Word. */
.ooxml-note-ref {
  vertical-align: super;
  font-size: 0.72em;
  line-height: 0;
  color: inherit;
  cursor: pointer;
}
.ooxml-note-ref:hover {
  color: #1a56db;
  text-decoration: underline;
}
.ooxml-note-area {
  margin-top: auto;
  padding-top: 4pt;
  font-size: 10pt;
}
.ooxml-note-separator {
  width: 33%;
  height: 0;
  border-top: 0.5pt solid #000;
  margin-bottom: 4pt;
}
.ooxml-note-item {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
}
.ooxml-note-label {
  vertical-align: super;
  font-size: 0.72em;
  flex: 0 0 auto;
}
.ooxml-note-body {
  flex: 1 1 auto;
  min-width: 0;
}
.ooxml-note-body p,
.ooxml-note-body [data-ooxml-paragraph-id] {
  margin: 0;
}
.ooxml-note-ref-active {
  background: #ffe066;
  border-radius: 2px;
}
.ooxml-note-item-active {
  background: #fff3bf;
  border-radius: 3px;
}

/* VML — ISO/IEC 29500-1 §14.1. Стара розмітка фігур Word: показуємо рамку,
   заливку, зображення й текст усередині, щоб нічого не зникало. */
.ooxml-vml { display: inline; }
.ooxml-vml-shape {
  box-sizing: border-box;
  overflow: hidden;
  max-width: 100%;
}
.ooxml-vml-text {
  display: block;
  padding: 2pt 4pt;
}
.ooxml-vml-text [data-ooxml-paragraph-id] { margin: 0; }
.ooxml-vml-group { display: inline-block; position: relative; }

/* Закладки — ISO/IEC 29500-1 §17.13.6. Межі нульової ширини; квадратні дужки
   показуються лише коли увімкнено «Показати закладки», як у Word. */
.ooxml-range-boundary {
  display: inline;
  width: 0;
  font-size: inherit;
  user-select: none;
}
.ooxml-show-bookmarks .ooxml-bookmark-start::before { content: '['; color: #888; }
.ooxml-show-bookmarks .ooxml-bookmark-end::before { content: ']'; color: #888; }
.ooxml-bookmark-target {
  background: #e7f5ff;
  border-radius: 3px;
  transition: background 0.4s ease;
}

/* Панель закладок */
.ooxml-bookmarks-add-row { display: flex; gap: 6px; align-items: center; }
.ooxml-bookmarks-name-input {
  flex: 1 1 auto; min-width: 0; padding: 5px 8px;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px;
  font: inherit;
}
.ooxml-bookmarks-add-btn {
  flex: 0 0 auto; padding: 5px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); background: #f6f8fa; font: inherit;
}
.ooxml-bookmarks-add-btn:hover { background: #eaeef2; }
.ooxml-bookmarks-hint { margin: 4px 0 0; font-size: 11px; opacity: 0.7; }
.ooxml-bookmarks-toggle { display: block; font-size: 12px; margin: 4px 0; cursor: pointer; }
.ooxml-bookmarks-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.ooxml-bookmarks-row { display: flex; align-items: stretch; gap: 4px; }
.ooxml-bookmarks-go {
  flex: 1 1 auto; min-width: 0; text-align: left; cursor: pointer; font: inherit;
  border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 4px 6px;
  display: flex; flex-direction: column; gap: 1px;
}
.ooxml-bookmarks-go:hover { background: #f2f6fb; border-color: #d0d7de; }
.ooxml-bookmarks-row-name { font-weight: 600; font-size: 12px; }
.ooxml-bookmarks-row-preview {
  font-size: 11px; opacity: 0.65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ooxml-bookmarks-row.is-hidden-bookmark .ooxml-bookmarks-row-name { opacity: 0.6; font-style: italic; }
.ooxml-bookmarks-delete {
  flex: 0 0 auto; width: 26px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; cursor: pointer; font: inherit; opacity: 0.55;
}
.ooxml-bookmarks-delete:hover { opacity: 1; background: #fdeaea; border-color: #f5c2c7; }
.ooxml-bookmarks-empty { margin: 6px 0; font-size: 12px; opacity: 0.7; }
.ooxml-bookmarks-status { margin-top: 8px; font-size: 11px; opacity: 0.75; }
.ooxml-bookmarks-status.is-error { color: #b42318; opacity: 1; }

/* Зупинки табуляції на лінійці — ISO/IEC 29500-1 §17.3.1.38.
   Ліворуч перемикач типу, як у Word; на самій лінійці — маркери зупинок. */
.ruler-tab-type {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 20px;
  border: 1px solid var(--ooxml-modal-border, #d0d7de);
  border-radius: 4px;
  background: #f6f8fa;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  z-index: 4;
}
.ruler-tab-type:hover { background: #eaeef2; }
.ruler-tab-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ruler-tab-stop {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #24292f;
  font-size: 12px;
  line-height: 1;
  cursor: grab;
  pointer-events: auto;
}
.ruler-tab-stop:hover { color: #0969da; }
.ruler-tab-stop.is-removing { opacity: 0.35; }
.ruler-track.dragging-tab .ruler-tab-stop { cursor: grabbing; }
.ruler-tab-layer.mixed-tabs { opacity: 0.4; }

/* Поля — ISO/IEC 29500-1 §17.16. Затінення вмикається окремо, як у Word. */
.ooxml-field { border-radius: 2px; }
.ooxml-show-fields .ooxml-field { background: #e9edf2; }
.ooxml-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ooxml-fields-preset {
  padding: 6px 8px; font: inherit; font-size: 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px; background: #f6f8fa;
}
.ooxml-fields-preset:hover { background: #eaeef2; }
.ooxml-fields-custom-row { display: flex; gap: 6px; }
.ooxml-fields-instr-input {
  flex: 1 1 auto; min-width: 0; padding: 5px 8px; font: inherit;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px;
}
.ooxml-fields-add-btn, .ooxml-fields-update-btn {
  padding: 5px 12px; font: inherit; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px; background: #f6f8fa;
}
.ooxml-fields-update-btn { width: 100%; margin-bottom: 6px; }
.ooxml-fields-add-btn:hover, .ooxml-fields-update-btn:hover { background: #eaeef2; }
.ooxml-fields-toggle { display: block; font-size: 12px; cursor: pointer; }
.ooxml-fields-status { margin-top: 8px; font-size: 11px; opacity: 0.75; }
.ooxml-fields-status.is-error { color: #b42318; opacity: 1; }
.ooxml-references-edit-grid { margin-bottom: 6px; }

/* Текстові рамки — ISO/IEC 29500-1 §17.3.1.11 (w:framePr).
   Рамка або пливе в тексті (float), або стоїть на сторінці за координатами. */
.ooxml-frame {
  box-sizing: border-box;
}
.ooxml-frame[data-ooxml-frame-anchored] {
  z-index: 2;
}
.ooxml-dropcap {
  /* Буквиця: перша літера абзацу на кілька рядків заввишки. */
  display: block;
}
.ooxml-dropcap [data-ooxml-paragraph-id] {
  margin: 0;
}

/* Групи фігур — ISO/IEC 29500-1 §20.1.2.2.20. Група має власний простір
   координат; діти стоять у ньому абсолютно. */
.ooxml-drawing-group { max-width: 100%; }
.ooxml-drawing-shape { box-sizing: border-box; overflow: hidden; }
.ooxml-drawing-shape-text {
  padding: 2pt 4pt;
  font-size: 10pt;
}
.ooxml-drawing-shape-text [data-ooxml-paragraph-id] { margin: 0; }

/* Колонки секції — ISO/IEC 29500-1 §17.6.4. Текст тече в них зверху вниз,
   зліва направо. Колонки БАЛАНСУЮТЬСЯ: Word вирівнює їх за висотою, і на
   останній сторінці секції короткий залишок так само ділиться навпіл, а не
   лишається однією довгою колонкою. */
.ooxml-page-columns {
  column-fill: balance;
}
/* Блок не розривається між колонками: пагінація міряє його як ціле, тож і
   колонки мають поводитися так само. Заразом це прибирає порожній фрагмент
   абзацу в сусідній колонці, через який браузер малював ДВІ каретки. */
.ooxml-page-columns > .ooxml-layout-block {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

/* Вбудовані об'єкти OLE — ISO/IEC 29500-1 §17.18.24. Показуємо прев'ю. */
.ooxml-ole-object { display: inline-block; vertical-align: middle; max-width: 100%; }
.ooxml-ole-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px dashed #9aa5b1;
  border-radius: 4px;
  font-size: 0.85em;
  color: #52606d;
}

/* Діаграми — ISO/IEC 29500-1 §21.2. Малюємо власним SVG із даних діаграми. */
.ooxml-chart { max-width: 100%; }
.ooxml-chart-svg { display: block; width: 100%; height: 100%; }
.ooxml-chart-badge {
  display: inline-block; padding: 2px 8px; border: 1px dashed #9aa5b1;
  border-radius: 4px; font-size: 0.85em; color: #52606d;
}

/* Виправлення — ISO/IEC 29500-1 §17.13.5. Подання «усі виправлення»:
   вставлене підкреслене, видалене закреслене — як у Word. */
.ooxml-tracked-ins {
  color: #1a56db;
  text-decoration: underline;
}
.ooxml-tracked-del {
  color: #b42318;
  text-decoration: line-through;
}
.ooxml-tracked.is-active { background: #fff3bf; }

/* Панель виправлень */
.ooxml-revisions-toggle { display: block; font-size: 12px; margin-bottom: 6px; cursor: pointer; }
.ooxml-revisions-bulk { display: flex; gap: 6px; }
.ooxml-revisions-bulk button {
  flex: 1 1 0; padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px; background: #f6f8fa;
}
.ooxml-revisions-bulk button:hover { background: #eaeef2; }
.ooxml-revisions-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.ooxml-revisions-row {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid transparent; border-radius: 6px; padding: 3px 4px;
}
.ooxml-revisions-row:hover { background: #f2f6fb; border-color: #d0d7de; }
.ooxml-revisions-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ooxml-revisions-head { font-size: 11px; font-weight: 600; }
.ooxml-revisions-row.is-ins .ooxml-revisions-head { color: #1a56db; }
.ooxml-revisions-row.is-del .ooxml-revisions-head { color: #b42318; }
.ooxml-revisions-preview {
  font-size: 11px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ooxml-revisions-accept, .ooxml-revisions-reject {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font: inherit;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); background: #fff;
}
.ooxml-revisions-accept:hover { background: #e6f4ea; }
.ooxml-revisions-reject:hover { background: #fdeaea; }
.ooxml-revisions-empty { margin: 6px 0; font-size: 12px; opacity: 0.7; }
.ooxml-revisions-status { margin-top: 8px; font-size: 11px; opacity: 0.75; }
.ooxml-revisions-status.is-error { color: #b42318; opacity: 1; }

/* BLUE object panels: page layout, shapes and charts. */
.ooxml-layout-window { width: min(372px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 96px)); }
/* Верх модалки задає стек панелей (78 px), низ збігається з верхом нижньої
   панелі редактора (40 px). Довгі параметри гортаються всередині body. */
.ooxml-layout-window.ooxml-shapes-window {
  height: calc(100vh - 118px);
  max-height: calc(100vh - 118px);
  min-height: 360px;
}
@media (max-height: 500px) {
  .ooxml-layout-window.ooxml-shapes-window { min-height: 0; }
}
.ooxml-layout-header { min-height: 52px; }
.ooxml-layout-heading { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.ooxml-layout-heading-icon { font-size: 21px; line-height: 1; }
.ooxml-layout-header-spacer { flex: 1 1 auto; }
.ooxml-layout-body { overflow: auto; }
.ooxml-panel-help { margin: 0 0 9px; color: #66717e; font-size: 11px; line-height: 1.4; }
.ooxml-layout-columns-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ooxml-layout-columns-grid button,
.ooxml-layout-wide {
  min-height: 34px; padding: 7px 9px; font: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 7px; background: #fff;
}
.ooxml-layout-columns-grid button:hover,
.ooxml-layout-wide:hover { border-color: #0b57d0; background: #edf4ff; }
.ooxml-layout-wide { width: 100%; margin-top: 9px; }
.ooxml-primary-action { border-color: #0b57d0 !important; background: #0b57d0 !important; color: #fff !important; font-weight: 700; }
.ooxml-primary-action:hover { background: #0848ad !important; }
.ooxml-layout-toggle { display: block; font-size: 12px; margin: 6px 0 2px; cursor: pointer; }
.ooxml-layout-field { display: block; font-size: 12px; margin-top: 6px; }
.ooxml-layout-field input,
.ooxml-layout-field select,
.ooxml-layout-field textarea {
  display: block; width: 100%; margin-top: 3px; padding: 5px 8px; font: inherit;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 6px; box-sizing: border-box;
}
.ooxml-layout-field input,
.ooxml-layout-field select { min-height: 34px; }
.ooxml-layout-field textarea { min-height: 112px; resize: vertical; line-height: 1.45; }
.ooxml-layout-inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ooxml-layout-command-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.ooxml-layout-command-row button {
  min-height: 36px; border: 1px solid #cbd1d8; border-radius: 7px; background: #fff; color: #2c3137; cursor: pointer;
}
.ooxml-layout-command-row button:hover { border-color: #0b57d0; background: #edf4ff; }
.ooxml-layout-preset-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.ooxml-layout-preset {
  min-width: 0; padding: 7px 3px 6px; border: 1px solid #d6dce4; border-radius: 8px; background: #fff; color: #34404d; cursor: pointer;
}
.ooxml-layout-preset:hover { border-color: #0b57d0; background: #f2f7ff; }
.ooxml-layout-preset.is-active { border-color: #0b57d0; background: #dce9ff; color: #0848ad; }
.ooxml-layout-preset > i { display: flex; width: 32px; height: 27px; gap: 3px; margin: 0 auto 5px; padding: 3px; border: 1px solid #9da8b5; background: #fff; box-sizing: border-box; }
.ooxml-layout-preset > i b { flex: 1; background: repeating-linear-gradient(to bottom, #788797 0 1px, transparent 1px 4px); }
.ooxml-layout-preset > i.is-left b:first-child,
.ooxml-layout-preset > i.is-right b:last-child { flex: .45; }
.ooxml-layout-preset > span { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
.ooxml-columns-live-preview { margin-top: 2px; }
.ooxml-columns-preview-page {
  position: relative; box-sizing: border-box; width: min(190px, 74%); aspect-ratio: 148 / 190;
  margin: 4px auto 0; padding: 20px 22px 19px; overflow: hidden;
  border: 1px solid #b9c3cf; border-radius: 2px; background: #fff;
  box-shadow: 0 5px 15px rgba(25, 44, 69, .13);
}
.ooxml-columns-preview-running-head {
  position: absolute; top: 11px; left: 22px; width: 42%; height: 2px; border-radius: 2px; background: #d2d9e2;
}
.ooxml-columns-preview-flow {
  --preview-column-gap: 16px;
  display: grid; height: 100%; column-gap: var(--preview-column-gap);
}
.ooxml-columns-preview-column {
  position: relative; display: flex; min-width: 0; flex-direction: column; justify-content: space-between; gap: 3px;
}
.ooxml-columns-preview-column i {
  display: block; height: 2px; min-height: 2px; border-radius: 2px; background: #738296;
}
.ooxml-columns-live-preview.has-separator .ooxml-columns-preview-column:not(:last-child)::after {
  content: ''; position: absolute; top: 0; right: calc(var(--preview-column-gap) / -2);
  width: 1px; height: 100%; background: #8b97a6; transform: translateX(50%);
}
.ooxml-columns-preview-page-number {
  position: absolute; right: 0; bottom: 6px; left: 0; color: #8a95a3; font: 7px/1 Arial, sans-serif; text-align: center;
}
.ooxml-columns-preview-caption {
  min-height: 29px; margin: 8px 0 0; color: #586574; font-size: 10px; line-height: 1.4; text-align: center;
}
.ooxml-layout-shapes-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 3px;
}
.ooxml-layout-shape-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 58px; padding: 7px 3px; font: inherit; font-size: 9px; cursor: pointer;
  border: 1px solid var(--ooxml-modal-border, #d0d7de); border-radius: 7px; background: #fff;
}
.ooxml-layout-shape-btn span:first-child { font-size: 22px; line-height: 1; }
.ooxml-layout-shape-btn span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ooxml-layout-shape-btn:hover { border-color: #0b57d0; background: #edf4ff; }
.ooxml-layout-shape-btn.is-active { border-color: #0b57d0; background: #dce9ff; color: #0848ad; }
#ooxmlEngineHost.ooxml-shape-draw-mode .ooxml-page { cursor: crosshair !important; user-select: none; -webkit-user-select: none; }
.ooxml-shape-draw-preview {
  position: absolute; z-index: 2147482000; pointer-events: none; box-sizing: border-box;
  overflow: visible; background: transparent;
}
.ooxml-shape-draw-preview > svg {
  display: block; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(25, 50, 86, .18));
}
.ooxml-shape-draw-preview-text {
  position: absolute; inset: 10%; display: grid; place-items: center; overflow: hidden;
  color: #20334d; font: 11px/1.2 Arial, sans-serif; text-align: center;
}
.ooxml-shape-color-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-top: 9px; }
.ooxml-shape-color-row label { color: #59616b; font-size: 10px; }
.ooxml-shape-color-row input { display: block; box-sizing: border-box; width: 100%; height: 34px; margin-top: 4px; padding: 3px; border: 1px solid #cbd1d8; border-radius: 7px; background: #fff; }
.ooxml-shape-color-row input[type="number"] { padding: 5px 7px; }
.ooxml-chart-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.ooxml-chart-type-grid button { display: grid; place-items: center; gap: 4px; min-height: 74px; border: 1px solid #d6dce4; border-radius: 8px; background: #fff; cursor: pointer; }
.ooxml-chart-type-grid button:hover { border-color: #0b57d0; background: #f2f7ff; }
.ooxml-chart-type-grid button.is-active { border-color: #0b57d0; background: #dce9ff; color: #0848ad; }
.ooxml-chart-type-grid i { width: 42px; height: 30px; font-style: normal; font-size: 28px; line-height: 28px; }
.ooxml-chart-type-grid i.is-bar { display: flex; align-items: end; justify-content: center; gap: 3px; border-bottom: 1px solid #6f7c8a; }
.ooxml-chart-type-grid i.is-bar b { width: 7px; background: #4472c4; }
.ooxml-chart-type-grid i.is-bar b:nth-child(1) { height: 13px; }
.ooxml-chart-type-grid i.is-bar b:nth-child(2) { height: 25px; }
.ooxml-chart-type-grid i.is-bar b:nth-child(3) { height: 18px; }
.ooxml-chart-type-grid span { font-size: 10px; }
.ooxml-chart-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ooxml-chart-options-grid label { display: flex; align-items: center; gap: 5px; min-height: 30px; font-size: 11px; }
.ooxml-chart-options-grid label:last-child { display: block; }
.ooxml-chart-options-grid select { width: 100%; height: 31px; margin-top: 3px; border: 1px solid #cbd1d8; border-radius: 6px; background: #fff; }
.ooxml-layout-status { margin-top: 8px; font-size: 11px; opacity: 0.75; }
.ooxml-layout-status.is-error { color: #b42318; opacity: 1; }
.ooxml-text-format-dropcap-icon { display: inline-flex; align-items: start; font-family: Georgia, serif; }
.ooxml-text-format-dropcap-icon b { font-size: 23px; line-height: 1; }
.ooxml-text-format-dropcap-icon sup { margin-top: 2px; font-size: 9px; }
.ooxml-dropcap-position-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ooxml-dropcap-position-grid button { padding: 9px; border: 1px solid #d6dce4; border-radius: 8px; background: #fff; cursor: pointer; }
.ooxml-dropcap-position-grid button.is-active { border-color: #0b57d0; background: #dce9ff; }
.ooxml-dropcap-position-grid button > span { display: block; min-height: 54px; color: #333d48; font: 13px/1.25 Georgia, serif; text-align: left; }
.ooxml-dropcap-position-grid button > span b { float: left; margin-right: 3px; font-size: 42px; line-height: .9; }
.ooxml-dropcap-position-grid button > span i { display: inline-block; font-style: normal; }
.ooxml-dropcap-position-grid button em { color: #52606d; font-size: 11px; font-style: normal; }
.ooxml-dropcap-live-preview {
  position: relative; min-height: 132px; margin-top: 10px; padding: 25px 12px 12px;
  overflow: hidden; border: 1px solid #cbd6e4; border-radius: 8px; background:
    repeating-linear-gradient(to bottom, transparent 0 17px, rgba(99,115,132,.11) 17px 18px), #fff;
  color: #2f3944; font: 12px/18px Georgia, serif;
}
.ooxml-dropcap-preview-caption {
  position: absolute; inset: 0 0 auto; height: 24px; padding: 4px 9px; box-sizing: border-box;
  border-bottom: 1px solid #dce2e8; background: #f6f8fa; color: #687583;
  font: 10px/15px Arial, sans-serif;
}
.ooxml-dropcap-live-preview p { position: relative; margin: 0; line-height: 18px; }
.ooxml-dropcap-preview-letter {
  float: left; box-sizing: content-box; height: calc(var(--dropcap-lines) * 18px);
  margin: 0 var(--dropcap-gap) 0 0; color: #172a46;
  font-size: calc(var(--dropcap-lines) * 15px); line-height: calc(var(--dropcap-lines) * 18px);
}
.ooxml-dropcap-live-preview.is-margin p { padding-left: 34px; }
.ooxml-dropcap-live-preview.is-margin .ooxml-dropcap-preview-letter {
  position: absolute; right: calc(100% - 28px); float: none; margin-right: var(--dropcap-gap);
}
.ooxml-dropcap-preview-copy { font: inherit; }
.ooxml-dropcap-status { min-height: 16px; margin: 8px 0 0; color: #52606d; font-size: 11px; }
.ooxml-dropcap-status.is-error { color: #b42318; }

/* ===================== RED Pressroom — режим для друкарень ================= */
/* Каркас той самий, що й у режимі порівняння: ліворуч документ, праворуч —
   замість вбудованого переглядача — звіт про готовність до друку.            */
.red-pressroom-pane {
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  overflow: hidden;
}
.red-pressroom-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border, #e2e6ee);
  flex: none;
}
.red-pressroom-tabs button {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--muted, #5a6472);
  border-radius: 7px 7px 0 0;
  cursor: pointer;
}
.red-pressroom-tabs button[aria-selected="true"] {
  background: var(--surface, #fff);
  border-color: var(--border, #e2e6ee);
  color: var(--text, #1d2530);
  font-weight: 600;
  margin-bottom: -1px;
}
.red-pressroom-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 16px 28px;
  font-size: 13px;
  line-height: 1.5;
}
.red-pressroom-hint { color: var(--muted, #5a6472); }

/* Загальний вердикт — найпомітніший елемент панелі: саме він вирішує,
   чи можна віддавати файл у друк.                                            */
.red-pressroom-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e6ee);
  margin-bottom: 14px;
}
.red-pressroom-head b { font-size: 15px; }
.red-pressroom-head span { color: var(--muted, #5a6472); }
.red-pressroom-head em {
  margin-left: auto;
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .04em;
}
.red-pressroom-head[data-status="ok"]   { background: #f2fbf5; border-color: #bfe6cd; }
.red-pressroom-head[data-status="warn"] { background: #fffaf0; border-color: #f0dcb0; }
.red-pressroom-head[data-status="fail"] { background: #fdf3f3; border-color: #eec4c4; }

.red-pressroom-section { margin-bottom: 18px; }
.red-pressroom-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted, #5a6472);
}
.red-pressroom-section ul { list-style: none; margin: 0; padding: 0; }
.red-pressroom-section > ul > li {
  display: flex;
  gap: 9px;
  padding: 8px 0;
  border-top: 1px solid var(--border-soft, #eef1f6);
}
.red-pressroom-mark { flex: none; width: 1.1em; text-align: center; font-weight: 700; }
.red-pressroom-section [data-status="ok"]   > .red-pressroom-mark,
.red-pressroom-section h3 .red-pressroom-mark { color: #2f8f52; }
.red-pressroom-section [data-status="warn"] > .red-pressroom-mark { color: #b8860b; }
.red-pressroom-section [data-status="fail"] > .red-pressroom-mark { color: #c0392b; }
.red-pressroom-section[data-status="warn"] h3 .red-pressroom-mark { color: #b8860b; }
.red-pressroom-section[data-status="fail"] h3 .red-pressroom-mark { color: #c0392b; }
.red-pressroom-section[data-status="info"] h3 .red-pressroom-mark { color: var(--muted, #5a6472); }

.red-pressroom-finding { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.red-pressroom-finding > span { color: var(--muted, #5a6472); }
/* Пояснення «чому це важливо» — саме через їх відсутність препрес-програми
   вимагають від оператора окремої освіти.                                    */
.red-pressroom-why {
  margin: 4px 0 0;
  padding-left: 9px;
  border-left: 2px solid var(--border, #e2e6ee);
  color: var(--muted, #5a6472);
  font-size: 12px;
}
.red-pressroom-pages { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.red-pressroom-pages button {
  appearance: none;
  border: 1px solid var(--border, #e2e6ee);
  background: var(--surface-soft, #f7f9fc);
  border-radius: 999px;
  padding: 2px 9px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.red-pressroom-pages button:hover { border-color: var(--accent, #2f6fd0); }

/* Рівень довіри до виправлення. Кольорова крапка тут не окраса: саме вона
   каже, чи можна тиснути не дивлячись.                                       */
.red-pressroom-fix {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted, #5a6472);
}
.red-pressroom-fix em { font-style: normal; }
.red-pressroom-fix-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.red-pressroom-fix[data-confidence="safe"]    .red-pressroom-fix-dot { background: #2f8f52; }
.red-pressroom-fix[data-confidence="usually"] .red-pressroom-fix-dot { background: #7fb069; }
.red-pressroom-fix[data-confidence="review"]  .red-pressroom-fix-dot { background: #d4a017; }
.red-pressroom-fix[data-confidence="risky"]   .red-pressroom-fix-dot { background: #c0392b; }
.red-pressroom-fix[data-confidence="manual"]  .red-pressroom-fix-dot { background: #8a94a6; }

.red-pressroom-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.red-pressroom-table th,
.red-pressroom-table td {
  text-align: left;
  padding: 5px 8px 5px 0;
  border-top: 1px solid var(--border-soft, #eef1f6);
  vertical-align: top;
}
.red-pressroom-table th { color: var(--muted, #5a6472); font-weight: 500; white-space: nowrap; }
.red-pressroom-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.red-pressroom-caps { display: flex; flex-wrap: wrap; gap: 6px; }
.red-pressroom-caps li {
  display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--border, #e2e6ee);
  border-radius: 999px; padding: 2px 10px; font-size: 12px;
}
.red-pressroom-caps li[data-cap="yes"]     { border-color: #bfe6cd; }
.red-pressroom-caps li[data-cap="no"]      { border-color: #eec4c4; }
.red-pressroom-caps li[data-cap="unknown"] { border-style: dashed; }

.red-pressroom-customer li { display: block; padding: 9px 0; border-top: 1px solid var(--border-soft, #eef1f6); }
.red-pressroom-customer li span { display: block; color: var(--muted, #5a6472); }
.red-pressroom-customer li p { margin: 5px 0 0; font-size: 12px; color: var(--muted, #5a6472); }

.red-pressroom-audit li { display: flex; gap: 10px; padding: 4px 0; font-size: 12.5px; }
.red-pressroom-audit time { color: var(--muted, #5a6472); font-variant-numeric: tabular-nums; }

#redPressroomVerdict[data-status="ok"]   { color: #2f8f52; }
#redPressroomVerdict[data-status="warn"] { color: #b8860b; }
#redPressroomVerdict[data-status="fail"] { color: #c0392b; }

/* Мітка панелі стоїть поверх вмісту, тож вкладки треба опустити під неї —
   інакше «RED Pressroom» накриває першу вкладку.                             */
.red-pressroom-pane .red-pressroom-tabs { padding-top: 34px; }

/* Перегляд для друкарні: стос фарб і матеріал. */
.red-pressroom-field { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.red-pressroom-field select { font: inherit; padding: 3px 6px; }
.red-pressroom-inks li {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0; border-top: 1px solid var(--border-soft, #eef1f6);
}
.red-pressroom-inks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.red-pressroom-false { margin-left: auto; font-size: 12px; color: var(--muted, #5a6472); }
.red-pressroom-swatch {
  width: 13px; height: 13px; border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .18); flex: none;
}
