* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
  --filefy-sb-width: 280px;
}

.sidebar {
  width: var(--filefy-sb-width, 280px);
  background: #1e2937;
  color: white;
  position: fixed;
  height: 100%;
  padding: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: width 0.22s ease, transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.main-content {
  margin-left: var(--filefy-sb-width, 280px);
  padding: 28px 32px 48px;
  width: calc(100% - var(--filefy-sb-width, 280px));
  max-width: none;
  box-sizing: border-box;
  transition: margin-left 0.22s ease, width 0.22s ease;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.container {
  background: white;
  padding: 32px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

h1 {
  margin-bottom: 24px;
  color: #1e2937;
  font-size: 1.8rem;
}

.upload-area {
  padding: 60px 30px;
  border: 3px dashed #6366f1;
  text-align: center;
  margin: 20px 0;
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  background: #f0f9ff;
  border-color: #4f46e5;
}

button {
  padding: 12px 28px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

a.btn-primary,
.btn-primary.btn-download,
a.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff !important;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.2s ease;
}
a.btn-primary:hover,
.btn-primary.btn-download:hover,
a.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.45);
  color: #fff !important;
}
button.btn-primary {
  background: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
button.btn-primary:hover {
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.result {
  margin-top: 24px;
  padding: 24px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  min-height: 100px;
}

.status {
  font-weight: 500;
  color: #64748b;
  margin: 12px 0;
}

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6366f1;
  font-weight: 500;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.preview-item {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  background: white;
  transition: transform 0.2s;
}

.preview-item:hover {
  transform: scale(1.03);
}

.preview-item img {
  width: 100%;
  height: auto;
  display: block;
}

.upload-area:hover, .upload-area.dragover {
      background: #f0f9ff;
      border-color: #4f46e5;
      transform: scale(1.02);
    }

.upload-area.dragover::after {
  content: "📂 Отпустите файлы здесь";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 600;
  color: #6366f1;
  background: white;
  padding: 20px 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  z-index: 1100;
  white-space: nowrap;
}

/* Sidebar as drawer ≤900px — matches sidebar.js / common.js */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1100;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    padding: 20px;
    overflow-x: hidden;
  }

  .container {
    padding: 24px;
  }

  h1 {
    font-size: 1.6rem;
  }
}

.mobile-menu-btn {
  display: none;
  touch-action: manipulation;
  user-select: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  background: #6365f17e;
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
  }
}



.seo-content {
  margin-top: 80px;
  background: white;
  border-radius: 24px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.07);
  padding: 52px 48px;
  border: 1px solid #e2e8f0;
}

.seo-content h2 {
  color: #1e2937;
  font-size: 1.7rem;
  margin-bottom: 28px;
  font-weight: 600;
  position: relative;
}

.seo-content h2::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #a5b4fc);
  border-radius: 4px;
  margin-top: 12px;
}

.seo-content p {
  margin-bottom: 20px;
  line-height: 1.75;
}

.seo-content ul,
.seo-content ol {
  padding-left: 22px;
  margin-bottom: 28px;
}

.seo-content li {
  margin-bottom: 14px;
  line-height: 1.75;
}

.seo-content table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
  margin: 32px 0;
  background: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.seo-content table thead,
.seo-content table tbody,
.seo-content table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.seo-content table thead {
  min-width: 520px;
}

.seo-content table tbody {
  min-width: 520px;
}

.seo-content th,
.seo-content td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.seo-content th {
  background: #f1f5f9;
  font-weight: 600;
  color: #1e2937;
}




/* ─── Word Editor (Google Docs style) ───────────────────────────────────── */

.word-workspace {
  background: #e8ecf0;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid #d0d7de;
  margin-bottom: 0;
  position: relative;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-workspace--disabled .word-toolbar {
  opacity: 1;
  pointer-events: none;
  filter: none;
}

.word-workspace--disabled .word-header {
  opacity: 0.85;
}

.word-workspace--disabled .word-toolbar .word-tb-btn,
.word-workspace--disabled .word-toolbar .word-tb-select,
.word-workspace--disabled .word-toolbar .word-tb-color {
  opacity: 0.55;
  cursor: not-allowed;
}

.word-workspace--disabled .word-pages-container {
  pointer-events: none;
  user-select: none;
  opacity: 0.65;
}

.word-workspace--disabled .word-page {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.word-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  flex-wrap: wrap;
  gap: 10px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.word-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.word-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #2b579a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'DM Sans', system-ui, sans-serif;
  flex-shrink: 0;
  filter: none;
}

.word-file-info strong,
.word-file-name {
  display: block;
  font-size: 0.92rem;
  color: #1e293b;
  font-weight: 600;
  font-family: 'DM Sans', system-ui, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-file-meta {
  font-size: 0.75rem;
  color: #64748b;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.word-header-actions .btn-word-download,
.btn-word-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2b579a;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: none;
}

.word-header-actions .btn-word-download:hover:not(:disabled),
.btn-word-download:hover:not(:disabled) {
  background: #1e4b8a;
  transform: none;
  box-shadow: none;
}

.word-header-actions .btn-word-secondary,
.btn-word-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.word-header-actions .btn-word-secondary:hover:not(:disabled),
.btn-word-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-word-download:disabled,
.btn-word-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.word-btn-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.word-btn-text {
  line-height: 1.2;
}

.btn-word-action-sm {
  min-height: 36px;
}

.btn-word-icon {
  font-size: 1rem;
  line-height: 1;
}

.word-notice {
  background: #fffbeb;
  color: #92400e;
  padding: 8px 14px;
  font-size: 0.82rem;
  border-bottom: 1px solid #fde68a;
  font-family: 'DM Sans', system-ui, sans-serif;
  flex-shrink: 0;
}

/* Ribbon */
.word-ribbon {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  z-index: 100;
  font-family: 'DM Sans', system-ui, sans-serif;
  overflow: visible;
}

.word-ribbon-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding: 0 10px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.word-ribbon-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 8px 14px 7px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #475569;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.word-ribbon-tab:hover {
  color: #1e293b;
  background: #f8fafc;
}

.word-ribbon-tab--active {
  color: #2b579a;
  font-weight: 600;
  border-bottom-color: #2b579a;
}

.word-toolbar {
  background: #f8fafc;
  border-bottom: none;
  padding: 0;
  box-shadow: none;
  position: relative;
  z-index: 1;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
}

.word-toolbar-row--home {
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 6px;
}

.word-ribbon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e8eef4;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
}

.word-ribbon-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.word-toolbar-group--row {
  flex-wrap: wrap;
  gap: 3px;
}

.word-tb-divider {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  margin: 0 2px;
  flex-shrink: 0;
}

.word-tb-compact {
  max-width: 88px;
  font-size: 0.72rem;
}

.word-tb-btn--caret {
  width: 24px;
  min-width: 24px;
  font-size: 0.7rem;
  color: #64748b;
}

.word-history-wrap {
  position: relative;
}

.word-history-panel[hidden] {
  display: none !important;
}

.word-popover-portal,
.word-popover-inner {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.16);
}

.word-popover-inner {
  max-height: min(420px, 70vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  min-width: 240px;
}

.word-popover-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px 8px;
}

.word-style-panel--portal,
.word-history-panel--portal {
  position: fixed;
}

.word-style-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.word-style-quick {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 1px solid #e2e8f0;
  background: #fafbfc;
  border-radius: 8px;
  padding: 4px 6px;
  cursor: pointer;
  min-width: 52px;
  font: inherit;
}

.word-style-quick:hover {
  border-color: #2b579a;
  background: #f0f7ff;
}

.word-style-quick-label {
  font-size: 0.62rem;
  color: #64748b;
  line-height: 1.1;
  text-align: center;
  max-width: 64px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-style-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px dashed #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  color: #64748b;
}

.word-style-more-btn:hover {
  border-color: #2b579a;
  color: #2b579a;
}

.word-style-preview-img--sm,
.word-style-preview-fallback--sm {
  width: 28px;
  height: 22px;
  font-size: 0.72rem;
}

.word-toolbar-row--design {
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.word-ribbon-card--design-wide {
  align-items: flex-start;
  min-width: min(480px, 100%);
}

.word-design-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
  padding-left: 2px;
}

.word-design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 720px;
}

.word-select-panel {
  min-width: 160px;
  max-width: min(320px, 92vw);
}

.word-select-option {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  color: #334155;
  text-align: left;
}

.word-select-option:hover {
  background: #f1f5f9;
}

.word-select-option--active {
  background: #eff6ff;
  color: #2b579a;
  font-weight: 600;
}

.word-design-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid #e2e8f0;
  background: #fafbfc;
  border-radius: 10px;
  padding: 8px 6px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.word-design-card:hover {
  border-color: #2b579a;
  box-shadow: 0 4px 12px rgba(43, 87, 154, 0.12);
}

.word-design-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.word-design-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: #f1f5f9;
  border-radius: 8px;
}

.word-design-preview-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.word-design-card-label {
  font-size: 0.68rem;
  color: #475569;
  text-align: center;
  line-height: 1.2;
}

.word-history-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  max-width: 280px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  padding: 4px;
}

.word-history-panel[hidden] {
  display: none !important;
}

.word-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  color: #475569;
  text-align: left;
}

.word-history-item:hover {
  background: #f1f5f9;
}

.word-history-item--active {
  background: #eff6ff;
  color: #1d4ed8;
}

.word-history-item-time {
  font-size: 0.68rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.word-history-empty {
  font-size: 0.78rem;
  color: #94a3b8;
  padding: 8px 10px;
  margin: 0;
}

.word-style-picker-wrap {
  position: relative;
}

.word-style-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  color: #334155;
  min-width: 120px;
}

.word-style-picker-btn:hover {
  border-color: #cbd5e1;
  background: #fafbfc;
}

.word-style-picker-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.word-style-picker-caret {
  color: #94a3b8;
  font-size: 0.7rem;
  margin-left: auto;
}

.word-style-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  width: min(360px, 80vw);
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
  padding: 8px;
}

.word-style-panel[hidden] {
  display: none !important;
}

.word-style-panel-group-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 8px 4px;
}

.word-style-panel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.word-style-panel-item:hover {
  background: #f1f5f9;
}

.word-style-preview-img {
  width: 40px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.word-style-preview-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}

.word-style-panel-label {
  font-size: 0.82rem;
  color: #334155;
}

.word-toolbar-row {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
  padding: 6px 10px 4px;
  min-width: max-content;
}

.word-toolbar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  flex-shrink: 0;
}

.word-toolbar-label {
  font-size: 0.65rem;
  color: #64748b;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

.word-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.word-toolbar-zoom {
  margin-left: auto;
}

.word-toolbar-sep {
  width: 1px;
  align-self: stretch;
  min-height: 36px;
  background: #d0d7de;
  margin: 2px 4px;
  flex-shrink: 0;
}

.word-tb-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  color: #334155;
  border: none;
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.word-tb-btn:hover:not(:disabled) {
  background: #e2e8f0;
}

.word-tb-btn.word-tb-active,
.word-tb-btn.word-tb-btn--active {
  background: #dbeafe;
  color: #1e40af;
}

.word-tb-btn:disabled,
.word-tb-select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.word-tb-text {
  width: auto;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.word-tb-select {
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: #fff;
  font-size: 0.8rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.1s;
}

.word-tb-select:hover:not(:disabled) {
  background: #fff;
  border-color: #cbd5e1;
}

.word-tb-font {
  min-width: 110px;
}

.word-tb-size {
  min-width: 48px;
}

.word-tb-color-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}

.word-tb-color-wrap:hover {
  background: #e2e8f0;
}

.word-tb-color-icon {
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  pointer-events: none;
  text-decoration: underline;
  text-decoration-color: #2b579a;
  text-underline-offset: 2px;
}

.word-tb-highlight-wrap .word-tb-color-icon {
  font-size: 0.8rem;
  font-weight: 400;
  text-decoration: none;
}

.word-tb-color {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.word-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-pages-wrap {
  overflow: auto;
  flex: 1;
  max-height: none;
  min-height: 0;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  background: #64748b;
  background-image: none;
  contain: layout paint;
  width: 100%;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.word-pages-wrap:not([data-word-zoomed]) {
  overflow-x: hidden;
}

.word-viewport-toolbar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  background: rgba(30, 41, 59, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.word-vc-label--hand {
  display: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-right: 2px;
}

.word-vc-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.word-vc-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.word-vc-btn--active,
.word-vc-btn.word-vc-btn--active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.word-vc-zoom {
  min-width: 42px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.word-vc-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
}

.word-hand-mode .word-pages-wrap {
  cursor: grab;
}

.word-hand-mode .word-pages-wrap.viewport-panning {
  cursor: grabbing;
}

.word-hand-mode .page-content,
.word-hand-mode .page-header,
.word-hand-mode .page-footer {
  pointer-events: none;
  user-select: none;
}

.word-pages-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 0;
  background: transparent;
  min-height: 0;
  transition: none;
}

.word-page {
  width: 794px;
  max-width: none;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 4px 6px rgba(15, 23, 42, 0.06),
    0 12px 28px rgba(15, 23, 42, 0.14);
  box-sizing: border-box;
  min-height: 1123px;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.word-page:focus-within {
  box-shadow:
    0 0 0 1px rgba(43, 87, 154, 0.35),
    0 4px 6px rgba(15, 23, 42, 0.06),
    0 12px 28px rgba(15, 23, 42, 0.14);
}

.page-header,
.page-footer {
  padding: 8px 76px;
  font-size: 9pt;
  color: #94a3b8;
  outline: none;
  min-height: 28px;
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

.page-footer {
  border-bottom: none;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
  text-align: center;
  color: #64748b;
}

.page-header:empty::before,
.page-footer:empty::before {
  content: attr(data-placeholder);
  color: #cbd5e1;
  pointer-events: none;
}

.page-content {
  outline: none;
  flex: 1;
  line-height: 1.65;
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 11pt;
  color: #1f2937;
  overflow: hidden;
  word-wrap: break-word;
}

.page-content.word-content--layered {
  position: relative;
}

.page-body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.word-figures-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
  box-sizing: border-box;
}

.word-figures-layer .word-figure {
  pointer-events: auto;
  touch-action: none;
}

.page-content:empty::before {
  content: "Начните редактировать документ...";
  color: #cbd5e1;
  pointer-events: none;
  font-family: 'DM Sans', system-ui, sans-serif;
}

mark.word-find-hit {
  background: #fde68a;
  color: inherit;
  padding: 0 1px;
  border-radius: 1px;
}

mark.word-find-hit--current {
  background: #f59e0b;
  outline: 2px solid #d97706;
}

.word-find-bar,
.word-table-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.85rem;
}

.word-find-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
}

.word-find-input,
.word-modal-input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  min-width: 140px;
  background: #fff;
}

.word-find-count {
  color: #64748b;
  margin-left: auto;
}

.word-table-bar-label {
  font-weight: 600;
  color: #334155;
  margin-right: 4px;
}

.word-page-break {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  padding: 8px;
  color: #94a3b8;
  font-size: 0.75rem;
  font-family: 'DM Sans', system-ui, sans-serif;
  border-top: 2px dashed #cbd5e1;
  border-bottom: 2px dashed #cbd5e1;
  user-select: none;
}

.word-autosave-status {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-right: 8px;
}

.word-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.word-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  width: min(420px, 100%);
  padding: 20px 22px;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-modal-title {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: #0f172a;
}

.word-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-modal-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
}

.word-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.word-modal-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #475569;
}

.word-modal-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.word-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.word-modal-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

.word-modal-btn--primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.word-img-selected {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
}

.word-workspace {
  position: relative;
}

.word-page h1, .page-content h1 { font-size: 22pt; margin: 0 0 14px 0; font-weight: 700; }
.word-page h2, .page-content h2 { font-size: 17pt; margin: 16px 0 8px 0; font-weight: 600; }
.word-page h3, .page-content h3 { font-size: 14pt; margin: 14px 0 6px 0; font-weight: 600; }
.word-page p, .page-content p {
  margin-bottom: 10px;
  text-align: justify;
}
.word-page ul, .word-page ol,
.page-content ul, .page-content ol {
  margin: 8px 0 10px 24px;
}
.word-page img, .page-content img {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 0;
}
.word-page table, .page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.word-page td, .word-page th,
.page-content td, .page-content th {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  font-size: 10pt;
  min-width: 40px;
}
.word-page hr, .page-content hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0;
}

/* Word body layout + navigation */
.word-body-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.word-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.word-nav-panel {
  width: 220px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.word-nav-panel--collapsed {
  width: 0;
  opacity: 0;
  overflow: hidden;
  border-right: none;
  pointer-events: none;
}

.word-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.word-nav-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.word-nav-toggle {
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.word-nav-toggle:hover {
  background: #e2e8f0;
}

.word-nav-search {
  margin: 8px 10px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  width: calc(100% - 20px);
  box-sizing: border-box;
}

.word-nav-tabs {
  display: flex;
  gap: 4px;
  padding: 0 10px 8px;
  flex-shrink: 0;
}

.word-nav-tab {
  flex: 1;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 0.72rem;
  cursor: pointer;
  color: #64748b;
}

.word-nav-tab--active {
  background: #2b579a;
  border-color: #2b579a;
  color: #fff;
}

.word-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
  min-height: 0;
}

.word-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-nav-item:hover {
  background: #e2e8f0;
}

.word-nav-item--l1 { padding-left: 8px; font-weight: 600; }
.word-nav-item--l2 { padding-left: 20px; }
.word-nav-item--l3 { padding-left: 32px; font-size: 0.78rem; color: #64748b; }

.word-nav-empty {
  font-size: 0.78rem;
  color: #94a3b8;
  padding: 8px;
  line-height: 1.45;
  margin: 0;
}

/* Style gallery + themes */
.word-styles-gallery,
.word-theme-row,
.word-template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 420px;
}

.word-style-chip,
.word-theme-chip,
.word-template-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  color: #334155;
  white-space: nowrap;
}

.word-style-chip:hover,
.word-theme-chip:hover,
.word-template-chip:hover {
  border-color: #2b579a;
  color: #2b579a;
}

.word-toolbar-styles .word-styles-gallery {
  max-width: 280px;
}

.word-st-title {
  font-size: 26pt;
  font-weight: 300;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.word-st-subtitle {
  font-size: 13pt;
  color: #64748b;
  margin: 0 0 14px 0;
}

.word-st-h1, .page-content .word-st-h1 {
  font-size: 22pt;
  font-weight: 700;
  margin: 0 0 14px 0;
}

.word-st-h2, .page-content .word-st-h2 {
  font-size: 17pt;
  font-weight: 600;
  margin: 16px 0 8px 0;
}

.word-st-h3, .page-content .word-st-h3 {
  font-size: 14pt;
  font-weight: 600;
  margin: 14px 0 6px 0;
}

.word-st-quote {
  margin: 10px 0 10px 8px;
  padding-left: 12px;
  border-left: 3px solid #cbd5e1;
  font-style: italic;
  color: #475569;
}

.word-st-normal {
  margin-bottom: 10px;
}

.word-pages-container {
  font-family: var(--word-theme-font, 'Source Serif 4', Georgia, serif);
}

.word-pages-container .word-st-h1,
.word-pages-container h1,
.word-pages-container .word-st-title {
  color: var(--word-theme-heading, #1e293b);
}

.word-pages-container .word-st-h2,
.word-pages-container h2 {
  color: var(--word-theme-heading, #1e293b);
}

/* Image figures */
.word-figure {
  position: relative;
  display: inline-block;
  vertical-align: top;
  line-height: 0;
  max-width: 100%;
}

.word-figure img {
  display: block;
  max-width: none;
  margin: 0;
  height: auto;
  border-radius: 0;
}

.word-fig--square-left {
  float: left;
  margin: 0 14px 8px 0;
  clear: left;
}

.word-fig--square-right {
  float: right;
  margin: 0 0 8px 14px;
  clear: right;
}

.word-fig--inline {
  display: inline-block;
  vertical-align: baseline;
  margin: 0 4px;
}

.word-fig--top-bottom {
  display: block;
  clear: both;
  margin: 12px auto;
  text-align: center;
}

.word-fig--free {
  position: absolute;
  z-index: 4;
  touch-action: none;
}

.word-fig-move {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b579a;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: grab;
  z-index: 5;
  user-select: none;
  letter-spacing: 1px;
}

.word-fig--selected .word-fig-move {
  display: block;
}

.word-figure:not(.word-fig--selected) .word-fig-move {
  opacity: 0.35;
  pointer-events: auto;
}

.word-figure:hover .word-fig-move,
.word-fig--selected .word-fig-move {
  opacity: 1;
}

.word-fig--dragging {
  opacity: 0.92;
  z-index: 20 !important;
  cursor: grabbing;
}

.word-fig--dragging .word-fig-move {
  cursor: grabbing;
}

.word-fig--dragging-source {
  opacity: 0.25;
}

.word-fig--ghost {
  position: fixed;
  z-index: 10001;
  pointer-events: none;
  opacity: 0.75;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  transform: rotate(-1deg);
}

.word-fig-drop-caret {
  position: fixed;
  width: 2px;
  height: 18px;
  background: #2b579a;
  border-radius: 1px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-1px, -9px);
}

.word-image-bar-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-left: 4px;
}

.word-fig--behind {
  position: absolute;
  z-index: 0;
  touch-action: none;
}

.word-fig--behind img {
  opacity: 0.35;
  pointer-events: none;
}

.word-fig--selected {
  outline: 2px solid #2b579a;
  outline-offset: 2px;
}

.word-fig-handles {
  display: none;
}

.word-fig--selected .word-fig-handles {
  display: block;
}

.word-fig-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #2b579a;
  border: 2px solid #fff;
  border-radius: 2px;
  box-sizing: border-box;
  z-index: 2;
}

.word-fig-handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.word-fig-handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.word-fig-handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.word-fig-handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }

.word-image-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.word-image-bar[hidden] {
  display: none !important;
}

.word-image-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-right: 4px;
}

.word-tb-active {
  background: #dbeafe !important;
  border-color: #2b579a !important;
  color: #1e40af !important;
}

.word-tb-list-style {
  max-width: 110px;
}

.word-main-col .word-pages-wrap {
  flex: 1;
  min-height: 0;
}

@media (max-width: 900px) {
  .word-nav-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: 4px 0 16px rgba(15, 23, 42, 0.12);
  }

  .word-nav-panel--collapsed {
    width: 0;
  }

  .word-nav-panel:not(.word-nav-panel--collapsed) {
    width: min(260px, 85vw);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  .word-ribbon-card--buffer .word-history-wrap {
    display: none;
  }
}

/* Overlay for empty state */
.word-editor-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  border-radius: 0;
}

.word-overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  border: 1px solid #e2e8f0;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-overlay-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.word-overlay-content h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: #1e293b;
}

.word-overlay-content p {
  color: #64748b;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.word-overlay-hint {
  font-size: 1rem !important;
  color: #334155 !important;
}

.word-overlay-sub {
  font-size: 0.85rem !important;
  color: #94a3b8 !important;
  margin-bottom: 0 !important;
}

/* Multi-file results */
.word-multi-results {
  padding: 20px;
}

.word-convert-result {
  padding: 4px 0;
}

.word-convert-success {
  margin: 0 0 6px;
  font-weight: 600;
  color: #0f172a;
}

.word-convert-meta {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 0.92rem;
}

.word-convert-hint {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.word-convert-actions {
  margin: 0;
}

.word-multi-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.word-multi-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.word-multi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.word-multi-card-actions {
  display: flex;
  gap: 8px;
}

.btn-word-action,
.btn-word-download-sm {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.btn-word-action {
  background: #eff6ff;
  color: #1e40af;
}

.btn-word-action:hover {
  background: #dbeafe;
}

.btn-word-download-sm {
  background: #2b579a;
  color: white;
}

.btn-word-download-sm:hover {
  background: #1e4b8a;
}

@media (max-width: 768px) {
  .word-pages-container {
    padding: 8px 0 24px;
    gap: 16px;
  }

  .word-pages-wrap {
    max-height: none;
    min-height: 0;
  }

  .word-header {
    padding: 10px 12px;
  }

  .word-toolbar-row {
    padding: 6px 8px 4px;
  }

  .word-ribbon-tab {
    padding: 8px 12px 6px;
    font-size: 0.78rem;
  }

  .word-tb-text {
    display: inline-flex;
  }

  .word-toolbar-label {
    display: none;
  }

  .page-header,
  .page-footer {
    padding: 6px 20px;
  }
}

/* ─── PDF Editor (FILEfy) ─────────────────────────────────────────────────── */

.pdf-editor-body {
  overflow: hidden;
}

/* SEO editor pages: body scrolls, app is viewport-sized block above SEO text */
.pdf-editor-body.pdf-editor-body--seo,
.fe-body.fe-body--seo,
.word-editor-body.word-editor-body--seo {
  overflow-x: hidden;
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}

.pdf-editor-body--seo .main-content--editor,
.fe-body--seo .main-content--fe,
.word-editor-body--seo .main-content {
  height: auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  width: calc(100% - var(--filefy-sb-width, 280px));
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
  box-sizing: border-box;
}

/* Photo editor PS shell: SEO must sit under the app, never beside it */
.fe-body.fe-body--ps.fe-body--seo {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}
.fe-body.fe-body--ps.fe-body--seo .main-content--fe {
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
}
.fe-body.fe-body--ps.fe-body--seo .seo-content--editor table,
body.fe-body--ps .seo-content--editor table {
  background: #12121a !important;
  color: #c9cdd8 !important;
}
body.fe-body--ps .seo-content--editor th,
body.fe-body--ps .seo-content--editor td {
  background: #12121a !important;
  color: #c9cdd8 !important;
  border-color: #2a2a36 !important;
}
body.fe-body--ps .seo-content--editor th {
  background: #1a1a24 !important;
  color: #e2e8f0 !important;
}

@media (max-width: 1024px) {
  .pdf-editor-body--seo .main-content--editor,
  .fe-body--seo .main-content--fe,
  .word-editor-body--seo .main-content,
  .word-editor-body .main-content {
    width: 100% !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
  }

  .main-content--editor,
  .main-content--fe {
    width: 100% !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
  }

  .fe-workspace,
  .pe-workspace {
    display: flex !important;
    flex-direction: column !important;
  }

  .fe-canvas-wrap,
  .pe-viewer {
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
  }
}

.main-content--editor {
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
  width: calc(100% - var(--filefy-sb-width, 280px));
  padding: 0;
  margin-left: var(--filefy-sb-width, 280px);
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  transition: margin-left 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.pe-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  background: #f1f5f9;
  overflow: hidden;
  position: relative;
  contain: layout;
}

.pe-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  flex-shrink: 0;
  z-index: 50;
}

.pe-topbar-left,
.pe-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pe-topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  min-width: 0;
}

.pe-doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pe-doc-icon { font-size: 1.5rem; }

.pe-doc-info strong {
  display: block;
  font-size: 0.92rem;
  color: #1e293b;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pe-doc-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.pe-topbar-sep {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
  margin: 0 4px;
}

.pe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  background: #6366f1;
  color: white;
}

.pe-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.pe-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pe-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.pe-btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(16,185,129,0.4);
}

.pe-btn-secondary {
  background: white;
  color: #4f46e5;
  border: 2px solid #c7d2fe;
  box-shadow: none;
}

.pe-btn-secondary:hover:not(:disabled) {
  background: #eef2ff;
  box-shadow: none;
}

.pe-btn-ghost {
  background: transparent;
  color: #475569;
  box-shadow: none;
  padding: 8px 10px;
}

.pe-btn-ghost:hover:not(:disabled) {
  background: #f1f5f9;
  box-shadow: none;
  transform: none;
}

.pe-btn-icon { padding: 8px; font-size: 1.1rem; }

.pe-btn-xs {
  padding: 6px 10px;
  font-size: 0.8rem;
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.pe-btn-xs:hover:not(:disabled) {
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.pe-btn-xs.active {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #a5b4fc;
}

.pe-btn-block {
  width: 100%;
  margin-bottom: 8px;
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  justify-content: flex-start;
}

.pe-btn-block:hover:not(:disabled) {
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.pe-btn-lg { padding: 14px 28px; font-size: 1rem; }

.pe-workspace {
  display: flex;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
}

.pe-panel {
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
}

.pe-panel-left {
  width: 200px;
}

.pe-panel-right {
  width: 280px;
  border-right: none;
  border-left: 1px solid #e2e8f0;
}

.pe-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.pe-panel-head h3 {
  font-size: 0.88rem;
  color: #1e293b;
  font-weight: 600;
}

.pe-thumbs-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pe-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: #f8fafc;
  padding: 6px;
}

.pe-thumb:hover { border-color: #c7d2fe; }

.pe-thumb.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}

.pe-thumb.dragging { opacity: 0.5; }

.pe-thumb canvas,
.pe-thumb img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.pe-thumb-num {
  text-align: center;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}

.pe-thumb-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 54px;
  z-index: 2;
}

.pe-thumb:hover .pe-thumb-actions,
.pe-thumb.active .pe-thumb-actions,
.pe-thumb.selected .pe-thumb-actions { display: flex; }

.pe-thumb-act {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
  font-family: inherit;
  padding: 0;
}

.pe-thumb-act:hover {
  background: #6366f1;
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.pe-thumb-act[data-act="delete"]:hover {
  background: #ef4444;
}

.pe-thumb-act:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.pe-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.pe-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.pe-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.pe-canvas-area {
  flex: 1;
  overflow: auto;
  background: #94a3b8;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.1) 1px, transparent 0);
  background-size: 16px 16px;
  display: block;
  padding: 0;
  overscroll-behavior: none;
  touch-action: none;
}

.viewport-artboard {
  box-sizing: content-box;
  min-width: max-content;
  min-height: max-content;
}

.pe-zoom-sizer {
  position: relative;
  overflow: hidden;
  line-height: 0;
  flex-shrink: 0;
}

.pe-canvas-area .viewport-artboard .pe-page-container {
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
}

.pe-upload-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  min-height: 60vh;
  padding: 32px 20px;
}

.pe-upload-box {
  text-align: center;
  max-width: 480px;
  padding: 48px 40px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(99,102,241,0.12);
  border: 2px dashed #c7d2fe;
  transition: all 0.2s;
}

.pe-upload-box.dragover {
  border-color: #6366f1;
  background: #f0f9ff;
}

.pe-upload-icon { font-size: 4rem; margin-bottom: 16px; }

.pe-upload-box h2 {
  font-size: 1.5rem;
  color: #1e293b;
  margin-bottom: 10px;
}

.pe-upload-box p {
  color: #64748b;
  margin-bottom: 24px;
}

.pe-upload-hint {
  font-size: 0.8rem !important;
  margin-top: 20px !important;
  margin-bottom: 0 !important;
  color: #94a3b8 !important;
}

.pe-page-wrap { display: flex; justify-content: center; }

.pe-page-container {
  position: relative;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  background: white;
}

.pe-page-container canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

#pdfRenderCanvas {
  z-index: 1;
  pointer-events: none;
}

#pageEditCanvas,
.pe-page-edit-canvas {
  z-index: 2;
  pointer-events: none;
}

.pe-page-container .canvas-container {
  position: absolute !important;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: auto !important;
  touch-action: none;
}

.pe-page-container .upper-canvas {
  pointer-events: auto !important;
  touch-action: none;
  z-index: 3;
}

.pe-page-container.pe-touch-pan .canvas-container,
.pe-page-container.pe-touch-pan .upper-canvas {
  touch-action: pan-x pan-y !important;
}

.pe-canvas-area.pe-touch-pan {
  touch-action: pan-x pan-y;
}

.pe-page-container .lower-canvas {
  pointer-events: none !important;
}

.pe-canvas-area.viewport-panning,
.pe-canvas-area.viewport-space-pan,
.pe-canvas-area.viewport-ctrl-pan,
.fe-canvas-area.viewport-panning,
.fe-canvas-area.viewport-space-pan,
.fe-canvas-area.viewport-ctrl-pan,
.word-pages-wrap.viewport-panning,
.word-pages-wrap.viewport-space-pan,
.word-pages-wrap.viewport-ctrl-pan {
  cursor: grab !important;
  user-select: none;
}

.pe-canvas-area.viewport-panning,
.fe-canvas-area.viewport-panning,
.word-pages-wrap.viewport-panning {
  cursor: grabbing !important;
}

.fe-zoom-sizer {
  flex-shrink: 0;
  line-height: 0;
}

.word-zoom-sizer {
  flex-shrink: 0;
  will-change: width, height;
  overflow: hidden;
  line-height: 0;
  display: inline-block;
  vertical-align: top;
}

.viewport-artboard--word-mobile {
  min-width: 0 !important;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.viewport-artboard--word-desktop {
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#fabricCanvas { z-index: 3; }

/* hidden-атрибут и класс — поверх display:flex в компонентах */
[hidden],
.is-hidden {
  display: none !important;
}

.pe-modal-overlay:not([hidden]) {
  display: flex;
}

.pe-panel-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
}

.pe-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  box-shadow: none;
  border-radius: 0;
}

.pe-tab:hover {
  color: #4338ca;
  background: #f8fafc;
  transform: none;
  box-shadow: none;
}

.pe-tab.active {
  color: #4338ca;
  border-bottom-color: #6366f1;
}

.pe-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.pe-tab-content.active { display: block; }

.pe-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.pe-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 0.72rem;
  color: #475569;
  font-weight: 500;
  transition: all 0.12s;
  box-shadow: none;
}

.pe-tool-btn:hover {
  background: #f8fafc;
  border-color: #c7d2fe;
  transform: none;
  box-shadow: none;
}

.pe-tool-btn.active {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #4338ca;
}

.pe-tool-btn span:first-child { font-size: 1.3rem; }
.pe-tool-btn .pe-tool-ico { font-size: 0; }
.pe-tool-btn .pe-tool-ico svg { width: 20px; height: 20px; }

.pe-tool-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
}

.pe-tool-section h4 {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pe-stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pe-sticker {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.12s;
  box-shadow: none;
  padding: 0;
}

.pe-sticker:hover {
  background: #fef3c7;
  transform: scale(1.1);
  box-shadow: none;
}

.pe-properties,
.pe-page-settings {
  font-size: 0.85rem;
}

.pe-prop-empty {
  color: #94a3b8;
  text-align: center;
  padding: 20px 0;
  font-size: 0.85rem;
}

.pe-prop-group {
  margin-bottom: 14px;
}

.pe-prop-group label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}

.pe-prop-group input,
.pe-prop-group select,
.pe-prop-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}

.pe-prop-row {
  display: flex;
  gap: 8px;
}

.pe-prop-row > * { flex: 1; }

.pe-prop-colors {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pe-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
}

.pe-color-swatch.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

.pe-progress {
  position: fixed;
  bottom: 0;
  left: 280px;
  right: 0;
  height: 4px;
  background: #e2e8f0;
  z-index: 100;
}

.pe-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  width: 0%;
  transition: width 0.2s;
}

.pe-progress span {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.pe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pe-modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}

.pe-modal h3 {
  margin-bottom: 16px;
  color: #1e293b;
}

.pe-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pe-modal-signature canvas {
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  width: 100%;
  cursor: crosshair;
}

.pe-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pe-mobile-toggle { display: none; }

@media (max-width: 1024px) {
  .pe-panel-right { width: 240px; }
  .pe-topbar-center { display: none; }
}

@media (max-width: 900px) {
  .main-content--editor { margin-left: 0; }
  .pe-progress { left: 0; }
  .pe-panel-left,
  .pe-panel-right {
    position: fixed;
    top: 56px;
    bottom: calc(52px + env(safe-area-inset-bottom, 0));
    z-index: 130;
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  .pe-panel-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
    border-left: 1px solid #e2e8f0;
  }
  .pe-panel-left.open { transform: translateX(0); }
  .pe-panel-right.open { transform: translateX(0); }
  .pe-mobile-toggle { display: inline-flex; }
  .pe-topbar-right .pe-btn-ghost span { display: none; }
}

/* ─── PDF Editor v2 extensions ─────────────────────────────────────────── */

.pe-btn-accent {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.pe-btn-sm { padding: 6px 10px; font-size: 0.78rem; }

.pe-doc-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 12px;
  background: var(--pe-panel-bg, #f8fafc);
  border-bottom: 1px solid var(--pe-border, #e2e8f0);
  overflow-x: auto;
  flex-shrink: 0;
}

.pe-doc-tab {
  padding: 6px 12px;
  border: 1px solid var(--pe-border, #e2e8f0);
  border-radius: 8px 8px 0 0;
  background: var(--pe-bg, #fff);
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.pe-doc-tab.active { background: var(--pe-accent-soft, #eef2ff); border-color: #6366f1; }
.pe-doc-tab-add { font-weight: 700; min-width: 32px; }
.pe-doc-tab-close { margin-left: 6px; opacity: 0.6; }

.pe-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--pe-panel-bg, #f8fafc);
  border-bottom: 1px solid var(--pe-border, #e2e8f0);
}

.pe-search-bar input { flex: 1; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--pe-border, #e2e8f0); }

.pe-bulk-bar {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--pe-border, #e2e8f0);
  flex-wrap: wrap;
}

.pe-thumb.selected { outline: 2px solid #6366f1; outline-offset: 2px; }
.pe-thumb-check {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
}

.pe-stamps { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-stamp-btn {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 4px 8px;
  border: 2px solid;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.pe-grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}

.pe-page-container { position: relative; }
.pe-page-container #fabricCanvas { position: absolute; top: 0; left: 0; z-index: 2; }

.pe-context-menu {
  position: fixed;
  z-index: 10050;
  min-width: 180px;
  background: var(--pe-bg, #fff);
  border: 1px solid var(--pe-border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  padding: 4px;
}

.pe-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  color: var(--pe-text, #1e293b);
}

.pe-ctx-item:hover:not(:disabled) { background: var(--pe-accent-soft, #eef2ff); }
.pe-ctx-item:disabled { opacity: 0.4; cursor: not-allowed; }
.pe-ctx-sep { height: 1px; background: var(--pe-border, #e2e8f0); margin: 4px 0; }

.pe-layers-list, .pe-history-list { padding: 8px; max-height: 50vh; overflow-y: auto; }
.pe-layer-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-bottom: 4px;
  background: var(--pe-panel-bg, #f8fafc);
  border: 1px solid transparent;
}

.pe-layer-item.active { border-color: #6366f1; background: var(--pe-accent-soft, #eef2ff); }
.pe-layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-layer-vis, .pe-layer-lock, .pe-layer-up, .pe-layer-down {
  border: none; background: transparent; cursor: pointer; padding: 2px 4px; font-size: 0.75rem;
}

.pe-history-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: var(--pe-panel-bg, #f8fafc);
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}

.pe-history-item.active { background: #6366f1; color: #fff; }

.pe-color-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.pe-palette-swatch {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  min-height: 20px;
  padding: 0;
}
.pe-palette-swatch.active { border-color: #6366f1; }

.pe-mobile-tool-panel {
  flex: 1 1 100%;
  order: -1;
  background: var(--pe-panel-bg, #f8fafc);
  border-bottom: 1px solid var(--pe-border, #e2e8f0);
  overflow: hidden;
}

.pe-mobile-tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: var(--pe-bg, #fff);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.82rem;
}

.pe-mobile-tool-panel.collapsed .pe-mobile-tool-body { max-height: 0; overflow: hidden; }
.pe-mobile-tool-body { max-height: 200px; overflow: auto; padding: 8px; transition: max-height 0.3s ease; }

.pe-mob-burger { display: flex; flex-direction: column; gap: 3px; width: 16px; }
.pe-mob-burger span { height: 2px; background: #64748b; border-radius: 1px; }
.pe-mob-chevron {
  width: 6px; height: 6px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  margin-left: auto;
}

.pe-viewer-toolbar { display: flex; flex-wrap: wrap; align-items: stretch; }
.pe-page-version-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
}
.pe-version-tabs {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.pe-version-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pe-version-tab:hover { background: #f1f5f9; color: #334155; }
.pe-version-tab.active {
  background: #6366f1;
  color: #fff;
}
.pe-page-num { font-size: 1.2rem; font-weight: 600; color: #1e293b; margin: 0; }
body[data-pe-theme="dark"] .pe-prop-cover { border-top: 1px solid var(--pe-border); padding-top: 8px; margin-top: 4px; }
body[data-pe-theme="dark"] .pe-page-version-switch {
  background: #1e1e2e;
  border-right-color: #333348;
}
body[data-pe-theme="dark"] .pe-version-tabs {
  border-color: #44445a;
  background: #2a2a3d;
}
body[data-pe-theme="dark"] .pe-version-tab { color: #94a3b8; }
body[data-pe-theme="dark"] .pe-version-tab:hover { background: #333348; color: #e2e8f0; }
body[data-pe-theme="dark"] .pe-version-tab.active { background: #6366f1; color: #fff; }
.pe-tool-btn.pe-tool-disabled,
.pe-tb-tool.pe-tool-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pe-viewer-toolbar-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex: 1;
}

body.pe-sidebar-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1099;
  pointer-events: auto;
}

/* Dark theme — мягкая палитра */
body[data-pe-theme="dark"] {
  --pe-bg: #14141f;
  --pe-panel-bg: #1c1c2a;
  --pe-surface: #222233;
  --pe-border: #2e2e42;
  --pe-text: #d8dee9;
  --pe-text-muted: #8b93a7;
  --pe-accent: #7c8aff;
  --pe-accent-soft: rgba(124, 138, 255, 0.14);
}

body[data-pe-theme="dark"] .pe-app { background: #0f0f17; color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-topbar {
  background: linear-gradient(180deg, #1a1a28 0%, #14141f 100%);
  border-color: var(--pe-border);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-topbar-center .pe-tb-tool,
body[data-pe-theme="dark"] .pe-tool-btn,
body[data-pe-theme="dark"] .pe-btn-ghost {
  color: var(--pe-text-muted);
  background: transparent;
}
body[data-pe-theme="dark"] .pe-topbar-center .pe-tb-tool:hover,
body[data-pe-theme="dark"] .pe-tool-btn:hover,
body[data-pe-theme="dark"] .pe-btn-ghost:hover {
  background: var(--pe-accent-soft);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-topbar-center .pe-tb-tool.active,
body[data-pe-theme="dark"] .pe-tool-btn.active {
  background: var(--pe-accent-soft);
  color: var(--pe-accent);
  border-color: rgba(124, 138, 255, 0.35);
}
body[data-pe-theme="dark"] .pe-doc-info strong,
body[data-pe-theme="dark"] .pe-doc-meta,
body[data-pe-theme="dark"] .pe-modal h3 { color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-doc-meta { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-panel {
  background: var(--pe-panel-bg);
  border-color: var(--pe-border);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-panel-head,
body[data-pe-theme="dark"] .pe-tab { color: var(--pe-text-muted); background: var(--pe-panel-bg); }
body[data-pe-theme="dark"] .pe-tab.active {
  color: var(--pe-accent);
  border-bottom-color: var(--pe-accent);
  background: var(--pe-surface);
}
body[data-pe-theme="dark"] .pe-viewer-toolbar,
body[data-pe-theme="dark"] .pe-viewer-toolbar-main {
  background: var(--pe-surface);
  border-color: var(--pe-border);
  color: var(--pe-text-muted);
}
body[data-pe-theme="dark"] .pe-canvas-area { background: #0c0c14; }
body[data-pe-theme="dark"] .pe-modal { background: var(--pe-surface); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-prop-group label,
body[data-pe-theme="dark"] .pe-prop-empty { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-page-num { color: var(--pe-text) !important; }
body[data-pe-theme="dark"] .pe-prop-group input,
body[data-pe-theme="dark"] .pe-prop-group select,
body[data-pe-theme="dark"] .pe-prop-group textarea {
  background: #14141f;
  border-color: var(--pe-border);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-btn { border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-btn-primary { background: #6366f1; color: #fff; }
body[data-pe-theme="dark"] .pe-btn-secondary { background: #2a2a3d; color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-thumb { background: #1a1a28; border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-thumb.active { border-color: var(--pe-accent); }
body[data-pe-theme="dark"] .pe-progress { background: #1a1a28; }
body[data-pe-theme="dark"] .pe-doc-tabs { background: var(--pe-panel-bg); border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-search-bar { background: var(--pe-surface); border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-search-bar input { background: #14141f; color: var(--pe-text); border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-tools-grid .pe-tool-btn {
  background: var(--pe-surface);
  border-color: var(--pe-border);
  color: var(--pe-text-muted);
}
body[data-pe-theme="dark"] .pe-tools-grid .pe-tool-btn:hover,
body[data-pe-theme="dark"] .pe-tools-grid .pe-tool-btn.active {
  background: var(--pe-accent-soft);
  border-color: rgba(124, 138, 255, 0.35);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-tool-section h4 { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-viewer-toolbar .pe-btn { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-viewer-toolbar .pe-btn:hover { background: var(--pe-accent-soft); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-zoom-label { color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-topbar-right .pe-btn { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-topbar-right .pe-btn:hover { background: var(--pe-accent-soft); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-topbar-right .pe-btn-secondary { background: #2a2a3d; color: var(--pe-text); border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-context-menu { background: var(--pe-surface); border-color: var(--pe-border); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-context-menu button:hover { background: var(--pe-accent-soft); }
body[data-pe-theme="dark"] .pe-layer-item { background: var(--pe-surface); border-color: var(--pe-border); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-history-item { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-upload-screen { background: #0c0c14; }
body[data-pe-theme="dark"] .pe-upload-box { background: var(--pe-panel-bg); border-color: var(--pe-border); color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-upload-box h2 { color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-upload-hint { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-page-container { background: #e8eaef; box-shadow: 0 12px 40px rgba(0,0,0,0.45); }

/* Подсказки вкладок и инструментов */
.pe-tab[title],
.pe-tool-btn[title],
.pe-tb-tool[title],
.pe-doc-tab-add[title] {
  cursor: help;
}

.pe-layers-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin: 0 0 10px;
  padding: 0 2px;
  line-height: 1.35;
}
body[data-pe-theme="dark"] .pe-layers-hint { color: var(--pe-text-muted); }

/* Обучалка после распознавания текста */
.pe-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
}
.pe-tutorial-overlay:not([hidden]) { pointer-events: auto; }
.pe-tutorial-card {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: 420px;
  width: calc(100% - 32px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  padding: 16px 18px;
  z-index: 10052;
  pointer-events: auto;
}
.pe-tutorial-body h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #1e293b;
}
.pe-tutorial-body p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.45;
}
.pe-tutorial-body p:last-child { margin-bottom: 0; }
.pe-tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.pe-tutorial-spotlight {
  position: fixed;
  border: 2px solid #6366f1;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.42);
  z-index: 10051;
  pointer-events: none;
  transition: all 0.25s ease;
}
.pe-prop-cover.pe-tutorial-highlight {
  outline: 2px solid #6366f1;
  outline-offset: 4px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.06);
}
body[data-pe-theme="dark"] .pe-tutorial-card {
  background: var(--pe-surface);
  border-color: var(--pe-border);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-tutorial-body h4 { color: var(--pe-text); }
body[data-pe-theme="dark"] .pe-tutorial-body p { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-layer-item.active {
  border-color: var(--pe-accent);
  background: var(--pe-accent-soft);
}

/* ─── Brush panel (pro) ─────────────────────────────────────────────────── */

.pe-brush-panel { display: flex; flex-direction: column; gap: 12px; }
.pe-brush-preview-wrap {
  position: relative;
  border: 1px solid var(--pe-border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}
.pe-brush-preview { display: block; width: 100%; height: auto; }
.pe-brush-preview-label {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pe-brush-section-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.pe-brush-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.pe-brush-preset-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: inherit;
  color: #334155;
  transition: background 0.15s, border-color 0.15s;
}
.pe-brush-preset-chip:hover {
  border-color: #6366f1;
  background: #eef2ff;
}
.pe-brush-preset-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-brush-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pe-brush-color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.pe-brush-color-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
}
.pe-brush-color-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
}
.pe-brush-subsection { margin-top: 8px; padding-top: 4px; }
.pe-brush-slider input[type="range"] { width: 100%; }
body[data-pe-theme="dark"] .pe-brush-preview-wrap { background: #14141f; border-color: var(--pe-border); }
body[data-pe-theme="dark"] .pe-brush-preset-chip {
  background: var(--pe-surface);
  border-color: var(--pe-border);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-brush-section-title { color: var(--pe-text-muted); }

/* ─── PDF Editor mobile UX ──────────────────────────────────────────────── */

.pe-mobile-bottom-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  background: linear-gradient(180deg, rgba(15,23,42,0.02), rgba(15,23,42,0.08)), var(--pe-panel-bg, #fff);
  border-top: 1px solid var(--pe-border, #e2e8f0);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}
.pe-mobile-bottom-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 8px;
  scrollbar-width: none;
}
.pe-mobile-bottom-scroll::-webkit-scrollbar { display: none; }
.pe-mob-tool-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 6px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  cursor: pointer;
}
.pe-mob-tool-btn.active {
  background: var(--pe-accent-soft, #eef2ff);
  color: #4f46e5;
}
.pe-mob-tool-icon { font-size: 1.15rem; line-height: 1; }
.pe-mob-tool-label { font-size: 0.62rem; font-weight: 500; white-space: nowrap; }
.pe-mob-tool-hint {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0;
  padding: 4px 2px;
  line-height: 1.4;
}

.pe-viewer-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.pe-mobile-tool-panel {
  width: 100%;
  order: -1;
  border-bottom: 1px solid var(--pe-border, #e2e8f0);
  background: var(--pe-panel-bg, #f8fafc);
}
.pe-mobile-tool-panel:not(.collapsed) {
  box-shadow: inset 0 1px 0 rgba(99, 102, 241, 0.1);
}
.pe-mobile-tool-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  color: #1e293b;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.pe-mob-tool-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 18px;
  height: 14px;
  flex-shrink: 0;
}
.pe-mob-tool-burger span {
  display: block;
  height: 2px;
  background: #64748b;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s;
}
.pe-mobile-tool-panel:not(.collapsed) .pe-mob-tool-burger span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
.pe-mobile-tool-panel:not(.collapsed) .pe-mob-tool-burger span:nth-child(2) { opacity: 0; }
.pe-mobile-tool-panel:not(.collapsed) .pe-mob-tool-burger span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}
.pe-mob-tool-icon { font-size: 1rem; flex-shrink: 0; }
.pe-mob-tool-title {
  flex: 1;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pe-mob-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform 0.25s ease;
}
.pe-mobile-tool-panel:not(.collapsed) .pe-mob-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}
.pe-mobile-tool-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease, opacity 0.25s;
  opacity: 0;
}
.pe-mobile-tool-panel:not(.collapsed) .pe-mobile-tool-body {
  max-height: min(42vh, 320px);
  opacity: 1;
}
.pe-mobile-tool-opts {
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 10px 12px 12px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
  .pe-mobile-bottom-bar { display: block; }
  .pe-app { padding-bottom: 64px; }
  .pe-workspace { flex: 1; min-height: 0; }
  .pe-viewer { min-height: 0; display: flex; flex-direction: column; }
  .pe-canvas-area {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    display: block;
  }
  .pe-page-wrap { max-width: 100%; }
  .pe-page-container { max-width: 100%; }
  .pe-viewer-toolbar-main {
    flex-wrap: wrap;
    justify-content: center;
    padding: 6px 8px;
    gap: 4px;
  }
  .pe-topbar-right .pe-btn-accent,
  .pe-topbar-right .pe-btn-sm { font-size: 0.7rem; padding: 5px 8px; }
  #btnMakeAllEditable { display: none; }
  .pe-panel-right.pe-panel { width: min(88vw, 300px); }
}

@media (max-width: 768px) {
  .pe-doc-info { display: none; }
  .pe-topbar-right .pe-btn-ghost:not(.pe-btn-icon) { padding: 6px; }
  .pe-mobile-tool-opts { max-height: min(38vh, 280px); }
  .pe-brush-grid-2 { grid-template-columns: 1fr; }
}

body[data-pe-theme="dark"] .pe-mobile-bottom-bar {
  background: var(--pe-panel-bg);
  border-color: var(--pe-border);
}
body[data-pe-theme="dark"] .pe-mobile-tool-header {
  background: linear-gradient(180deg, #1c1c2a, #14141f);
  color: var(--pe-text);
}
body[data-pe-theme="dark"] .pe-mob-tool-btn { color: var(--pe-text-muted); }
body[data-pe-theme="dark"] .pe-mob-tool-btn.active {
  background: var(--pe-accent-soft);
  color: var(--pe-accent);
}

@media (max-width: 1024px) {
  .pe-topbar-center { display: none; }
  .pe-mobile-toggle { display: inline-flex; }
  .pe-panel-left, .pe-panel-right {
    position: fixed;
    top: 48px;
    bottom: 0;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.25s;
    max-width: min(100vw, 300px);
  }
  .pe-panel-right { right: 0; left: auto; transform: translateX(100%); }
  .pe-panel-left.open, .pe-panel-right.open { transform: translateX(0); box-shadow: 0 8px 32px rgba(0,0,0,0.35); }
}

@media (max-width: 900px) {
  .main-content--editor { margin-left: 0; }
  .pe-topbar { flex-wrap: wrap; padding: 6px 8px; }
  .pe-topbar-right .pe-btn-sm { padding: 6px 8px; font-size: 0.72rem; }
  .pe-doc-tabs { padding: 4px 8px; }
}

@media (max-width: 380px) {
  .pe-topbar-right .pe-btn-secondary { display: none; }
  #btnMakeAllEditable { display: none; }
}

/* ─── Photo Editor (FILEfy) — light studio theme ───────────────────────── */

.fe-body {
  overflow: hidden;
}

.fe-body.fe-body--seo {
  overflow-y: auto;
  overflow-x: hidden;
}

.fe-body--seo .main-content--fe {
  height: auto;
  overflow-x: hidden;
  overflow-y: visible;
  width: calc(100% - var(--filefy-sb-width, 280px));
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
}

.main-content--fe {
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
  width: calc(100% - var(--filefy-sb-width, 280px));
  padding: 0;
  margin-left: var(--filefy-sb-width, 280px);
  height: 100vh;
  overflow: hidden;
  background: var(--fe-bg, #f1f2f4);
  box-sizing: border-box;
  transition: margin-left 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.fe-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  contain: layout;
  background: var(--fe-bg);
  color: var(--fe-text);
  font-family: 'DM Sans', system-ui, sans-serif;
  --fe-bg: #f1f2f4;
  --fe-panel: #ffffff;
  --fe-surface: #f7f8f9;
  --fe-accent: #0f766e;
  --fe-accent-hover: #0d9488;
  --fe-accent-soft: rgba(15, 118, 110, 0.1);
  --fe-accent-muted: #5eead4;
  --fe-text: #1c2430;
  --fe-muted: #64748b;
  --fe-border: #e2e5ea;
  --fe-border-strong: #d0d5dd;
  --fe-canvas: #e6e8ec;
  --fe-danger: #dc2626;
  --fe-success: #0f766e;
}

.fe-app,
.fe-workspace {
  max-width: 100%;
  overflow: hidden;
}

.fe-panel-right,
.fe-panel-left {
  flex-shrink: 0;
}

.fe-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--fe-panel);
  border-bottom: 1px solid var(--fe-border);
  flex-shrink: 0;
  min-height: 52px;
  transition: padding 0.2s ease;
}

.fe-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.fe-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fe-topbar-menu {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.fe-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fe-brand-icon { font-size: 1.35rem; opacity: 0.9; }

.fe-brand strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fe-text);
}

.fe-meta {
  font-size: 0.72rem;
  color: var(--fe-muted);
  font-weight: 450;
}

.fe-menu-btn {
  padding: 7px 12px;
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  color: var(--fe-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fe-menu-btn:hover {
  background: #eef0f3;
  border-color: var(--fe-border-strong);
  color: var(--fe-text);
}

.fe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border: none;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  background: var(--fe-accent);
  color: #fff;
}

.fe-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.fe-btn-ghost {
  background: transparent;
  color: var(--fe-muted);
  padding: 9px 11px;
}

.fe-btn-ghost:hover:not(:disabled) {
  background: var(--fe-surface);
  color: var(--fe-text);
}

.fe-btn-accent {
  background: var(--fe-accent);
  color: #fff;
}

.fe-btn-accent:hover:not(:disabled) {
  background: var(--fe-accent-hover);
}

.fe-btn-accent-sm {
  background: var(--fe-accent);
  font-size: 0.78rem;
  padding: 7px 13px;
}

.fe-btn-sm {
  padding: 6px 11px;
  font-size: 0.78rem;
  background: var(--fe-surface);
  color: var(--fe-text);
  border: 1px solid var(--fe-border);
}

.fe-btn-sm:hover:not(:disabled) {
  background: #eef0f3;
  border-color: var(--fe-border-strong);
}

.fe-btn-lg { padding: 14px 28px; font-size: 1rem; }

.fe-btn-danger {
  background: var(--fe-danger);
  width: 100%;
  margin-top: 8px;
}

.fe-btn-icon { padding: 9px; }

.fe-sep {
  width: 1px;
  height: 22px;
  background: var(--fe-border);
  margin: 0 4px;
}

.fe-workspace {
  display: flex;
  flex: 1;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  min-width: 0;
}

.fe-panel {
  background: var(--fe-panel);
  border-right: 1px solid var(--fe-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.fe-panel-left {
  width: 200px;
  flex-shrink: 0;
}

.fe-panel-right {
  width: 280px;
  flex-shrink: 0;
  border-right: none;
  border-left: 1px solid var(--fe-border);
  background: var(--fe-surface);
}

.fe-panel-title {
  padding: 14px 16px 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fe-muted);
  font-weight: 600;
}

.fe-mt { margin-top: 8px; }

.fe-tools {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 10px 14px;
}

.fe-tool {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  min-height: 42px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--fe-muted);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fe-tool:hover {
  background: var(--fe-surface);
  color: var(--fe-text);
}

.fe-tool.active {
  background: var(--fe-accent-soft);
  color: var(--fe-accent);
  border-color: rgba(15, 118, 110, 0.22);
}

.fe-tool-icon { font-size: 1.05rem; width: 24px; text-align: center; }

.fe-shapes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 0 12px 14px;
}

.fe-shape {
  aspect-ratio: 1;
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  color: var(--fe-text);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.fe-shape:hover, .fe-shape.active {
  background: var(--fe-accent);
  border-color: var(--fe-accent);
  color: #fff;
}

.fe-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.fe-canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--fe-panel);
  border-bottom: 1px solid var(--fe-border);
  flex-shrink: 0;
  min-height: 46px;
}

.fe-canvas-toolbar-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.fe-canvas-area {
  flex: 1;
  overflow: auto;
  display: block;
  min-width: 0;
  max-width: 100%;
  background-color: var(--fe-canvas);
  background-image:
    linear-gradient(rgba(100, 116, 139, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 116, 139, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 0;
  overscroll-behavior: none;
  touch-action: none;
}

.fe-canvas-stage {
  position: relative;
  transform-origin: 0 0;
  box-shadow:
    0 1px 2px rgba(28, 36, 48, 0.04),
    0 8px 24px rgba(28, 36, 48, 0.08);
  border-radius: 2px;
}

.fe-selection-fill {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 1;
}

.fe-selection-ants {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.fe-sel-ants {
  stroke-dasharray: 4 4;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.fe-sel-ants--white {
  animation: fe-sel-ants-w 0.55s linear infinite;
}

.fe-sel-ants--black {
  stroke-dashoffset: 4;
  animation: fe-sel-ants-b 0.55s linear infinite;
}

@keyframes fe-sel-ants-w {
  to { stroke-dashoffset: -8; }
}

@keyframes fe-sel-ants-b {
  to { stroke-dashoffset: 4; }
}

.fe-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
}

.fe-welcome-box {
  text-align: center;
  max-width: 440px;
  padding: 48px 40px;
  background: var(--fe-panel);
  border-radius: 18px;
  border: 1.5px dashed var(--fe-border-strong);
  box-shadow: 0 1px 2px rgba(28, 36, 48, 0.04);
}

.fe-welcome-box.dragover {
  border-color: var(--fe-accent);
  background: var(--fe-accent-soft);
}

.fe-welcome-icon { font-size: 3.25rem; margin-bottom: 16px; opacity: 0.85; }

.fe-welcome-box h2 {
  color: var(--fe-text);
  margin-bottom: 10px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.fe-welcome-box p { color: var(--fe-muted); margin-bottom: 24px; font-size: 0.95rem; }

.fe-hint { font-size: 0.8rem !important; color: var(--fe-muted) !important; margin-top: 16px !important; }

.fe-filmstrip {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--fe-panel);
  border-top: 1px solid var(--fe-border);
  overflow-x: auto;
  flex-shrink: 0;
}

.fe-film-thumb {
  flex-shrink: 0;
  width: 72px;
  background: var(--fe-surface);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 4px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.12s ease;
}

.fe-film-thumb.active { border-color: var(--fe-accent); }

.fe-film-thumb img {
  width: 100%;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.fe-film-thumb span {
  display: block;
  text-align: center;
  font-size: 0.7rem;
  color: var(--fe-muted);
  margin-top: 2px;
}

.fe-tabs {
  display: flex;
  border-bottom: 1px solid var(--fe-border);
  background: var(--fe-panel);
  padding: 0 6px;
}

.fe-tab {
  flex: 1;
  padding: 12px 6px;
  background: transparent;
  border: none;
  color: var(--fe-muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.fe-tab.active {
  color: var(--fe-accent);
  border-bottom-color: var(--fe-accent);
}

.fe-tab-pane {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.fe-tab-pane.active { display: flex; }

.fe-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.fe-section {
  margin-bottom: 14px;
  padding: 14px 14px 12px;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 12px;
}

.fe-section h4 {
  font-size: 0.72rem;
  color: var(--fe-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 12px;
}

.fe-slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--fe-muted);
}

.fe-slider input[type="range"] { grid-column: 1 / -1; accent-color: var(--fe-accent); }

.fe-val { font-size: 0.72rem; color: var(--fe-muted); font-variant-numeric: tabular-nums; }

.fe-field {
  margin-bottom: 12px;
}

.fe-field label {
  display: block;
  font-size: 0.75rem;
  color: var(--fe-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.fe-field input, .fe-field select, .fe-field textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  color: var(--fe-text);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.12s ease;
}

.fe-field input:focus, .fe-field select:focus, .fe-field textarea:focus {
  outline: none;
  border-color: var(--fe-accent);
}

.fe-field-row { display: flex; gap: 10px; }
.fe-field-row .fe-field { flex: 1; }

.fe-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--fe-muted);
  margin: 12px 0;
}

.fe-crop-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fe-preset {
  padding: 6px 11px;
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  color: var(--fe-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.fe-preset.active, .fe-preset:hover {
  background: var(--fe-accent);
  color: #fff;
  border-color: var(--fe-accent);
}

.fe-empty {
  color: var(--fe-muted);
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
}

.fe-layer-actions {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--fe-border);
  background: var(--fe-panel);
}

.fe-layers { padding: 10px; }

.fe-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.fe-layer-item.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--fe-accent-soft);
}

.fe-layer-vis, .fe-layer-lock {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}

.fe-layer-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fe-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fe-layer-op {
  width: 100%;
  accent-color: var(--fe-accent);
  margin: -2px 0 8px;
  display: block;
}

.fe-layer-block { margin-bottom: 6px; }

.fe-layer-up, .fe-layer-down {
  background: none;
  border: none;
  color: var(--fe-muted);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 4px;
  line-height: 1;
}

.fe-layer-up:hover, .fe-layer-down:hover { color: var(--fe-text); }

.fe-live-badge {
  font-size: 0.6rem;
  background: var(--fe-accent);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
}

.fe-hint-sm {
  font-size: 0.72rem;
  color: var(--fe-muted);
  margin-top: 8px;
}

.fe-prop-type {
  font-size: 0.75rem;
  color: var(--fe-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-weight: 600;
}

.fe-prop-style {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.fe-btn-xs {
  padding: 7px 10px;
  font-size: 0.8rem;
  min-width: 34px;
}

.fe-btn-block { width: 100%; margin-top: 8px; }

.fe-canvas-area.dragover .fe-canvas-stage {
  outline: 2px dashed var(--fe-accent);
  outline-offset: 4px;
}

.fe-crop-shade {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.fe-crop-box {
  position: absolute;
  border: 2px solid var(--fe-accent);
  box-shadow: 0 0 0 9999px rgba(28, 36, 48, 0.45);
  cursor: move;
  pointer-events: auto;
}

.fe-crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--fe-accent);
  border: 1px solid #fff;
  border-radius: 2px;
}

.fe-crop-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.fe-crop-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.fe-crop-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.fe-crop-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.fe-crop-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.fe-crop-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.fe-crop-handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.fe-crop-handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* Tool options + color bar */
.fe-tool-options {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--fe-border);
  min-height: 80px;
  background: var(--fe-surface);
}

.fe-tool-options-empty { font-size: 0.75rem; margin: 0; color: var(--fe-muted); }

.fe-color-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--fe-border);
  background: var(--fe-panel);
}

.fe-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1.5px solid var(--fe-border-strong);
  cursor: pointer;
  flex-shrink: 0;
}

.fe-color-hex {
  font-size: 0.72rem;
  color: var(--fe-muted);
  font-family: monospace;
}

.fe-eyedropper-btn.active {
  background: var(--fe-accent);
  color: white;
}

/* Shapes dropdown */
.fe-shapes-wrap { position: relative; }

.fe-shapes-trigger .fe-caret {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.6;
}

.fe-shapes-menu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 4px;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 12px;
  padding: 6px;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.1);
}

.fe-shapes-menu[hidden] { display: none; }

.fe-shape-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: none;
  color: var(--fe-text);
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.fe-shape-item:hover, .fe-shape-item.active {
  background: var(--fe-accent-soft);
  color: var(--fe-accent);
}

.fe-shape-item span:first-child { width: 22px; text-align: center; }

/* History list */
.fe-history-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fe-hist-item {
  text-align: left;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--fe-surface);
  color: var(--fe-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.fe-hist-item:hover {
  background: #eef0f3;
  color: var(--fe-text);
}

.fe-hist-item.active {
  background: var(--fe-accent-soft);
  color: var(--fe-accent);
  border-color: rgba(15, 118, 110, 0.22);
}

.fe-layer-item.drag-over {
  outline: 2px dashed var(--fe-accent);
  background: var(--fe-accent-soft);
}

.fe-layer-blend {
  width: 100%;
  margin: 0 0 6px;
  padding: 5px 9px;
  font-size: 0.72rem;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 7px;
  color: var(--fe-text);
}

.fe-ctx-menu {
  position: fixed;
  z-index: 3000;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 12px;
  padding: 4px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.12);
}

.fe-ctx-menu[hidden] { display: none; }

.fe-ctx-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  color: var(--fe-text);
  font-size: 0.82rem;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
}

.fe-ctx-item:hover { background: var(--fe-accent-soft); color: var(--fe-accent); }

.fe-panel-left { display: flex; flex-direction: column; }

.fe-welcome-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 8px; }

.fe-modal-lg { max-width: 520px; }

.fe-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  max-height: 280px;
  overflow-y: auto;
}

.fe-template-btn {
  padding: 11px 12px;
  border: 1px solid var(--fe-border);
  border-radius: 10px;
  background: var(--fe-surface);
  color: var(--fe-text);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.fe-template-btn:hover, .fe-template-btn.active {
  border-color: rgba(15, 118, 110, 0.4);
  background: var(--fe-accent-soft);
}

.fe-layer-objects-wrap {
  border-top: 1px solid var(--fe-border);
  padding-top: 8px;
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.fe-layer-objects { flex: 1; padding: 4px 8px; }

.fe-layer-obj-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--fe-muted);
  cursor: pointer;
  margin-bottom: 2px;
}

.fe-layer-obj-item:hover { background: var(--fe-surface); color: var(--fe-text); }

.fe-layer-obj-item.active {
  background: var(--fe-accent-soft);
  color: var(--fe-accent);
}

.fe-stamp-preview {
  position: absolute;
  border: 2px solid rgba(15, 118, 110, 0.75);
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

#photoEditorApp ~ .mobile-menu-btn,
body.fe-body > .mobile-menu-btn,
#pdfEditorApp ~ .mobile-menu-btn,
body.pdf-editor-body > .mobile-menu-btn {
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fe-mobile-burgers {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: 10px;
  padding: 2px;
  transition: background 0.2s ease;
}

.fe-mobile-burgers .fe-btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.fe-mobile-burgers .fe-btn-icon:hover {
  background: #eef0f3;
}

/* ─── Mobile tool settings panel ─────────────────────────────────────────── */

.fe-mobile-tool-panel {
  flex: 1 1 100%;
  order: -1;
  width: 100%;
  background: var(--fe-panel);
  border-bottom: 1px solid var(--fe-border);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}

.fe-mobile-tool-panel:not(.collapsed) {
  box-shadow: inset 0 1px 0 var(--fe-accent-soft);
}

.fe-mobile-tool-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: var(--fe-panel);
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--fe-text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.fe-mobile-tool-panel:not(.collapsed) .fe-mobile-tool-header {
  border-bottom-color: var(--fe-border);
}

.fe-mobile-tool-header:active {
  background: var(--fe-surface);
}

.fe-mob-tool-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 18px;
  height: 14px;
  flex-shrink: 0;
}

.fe-mob-tool-burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--fe-muted);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.2s ease;
}

.fe-mobile-tool-panel:not(.collapsed) .fe-mob-tool-burger span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
  background: var(--fe-accent);
}

.fe-mobile-tool-panel:not(.collapsed) .fe-mob-tool-burger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.fe-mobile-tool-panel:not(.collapsed) .fe-mob-tool-burger span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
  background: var(--fe-accent);
}

.fe-mob-tool-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.fe-mob-tool-title {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fe-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fe-mob-tool-chevron {
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--fe-muted);
  border-bottom: 2px solid var(--fe-muted);
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-top: -3px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
}

.fe-mobile-tool-panel:not(.collapsed) .fe-mob-tool-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
  border-color: var(--fe-accent);
}

.fe-mobile-tool-body {
  max-height: 220px;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  opacity: 1;
}

.fe-mobile-tool-panel.collapsed .fe-mobile-tool-body {
  max-height: 0;
  opacity: 0;
}

.fe-mobile-tool-opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(36vh, 220px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.5) transparent;
}

.fe-mobile-tool-opts::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.fe-mobile-tool-opts::-webkit-scrollbar-thumb {
  background: var(--fe-accent);
  border-radius: 4px;
}

.fe-m-section {
  background: #f8fafc;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  padding: 7px 9px;
  flex-shrink: 0;
  grid-column: 1 / -1;
}

.fe-m-section-head {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 6px;
  padding-bottom: 0;
  border-bottom: none;
}

.fe-m-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  align-items: center;
}

.fe-m-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.fe-m-chips--sliders {
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed var(--fe-border);
}

.fe-m-slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fe-m-slider:focus-within {
  border-color: var(--fe-accent);
  background: var(--fe-accent-soft);
}

.fe-m-slider-label {
  font-size: 0.68rem;
  color: var(--fe-muted);
  white-space: nowrap;
  min-width: 2.6em;
}

.fe-m-slider input[type="range"] {
  width: 80px;
  min-width: 56px;
  max-width: 110px;
  accent-color: var(--fe-accent);
  cursor: pointer;
}

.fe-m-slider-val {
  font-size: 0.65rem;
  color: var(--fe-text);
  min-width: 1.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fe-m-color-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid var(--fe-accent);
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fe-m-color-btn:active { transform: scale(0.94); }

.fe-m-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--fe-muted);
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fe-m-toggle:has(input:checked) {
  background: var(--fe-accent-soft);
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--fe-accent);
}

.fe-m-toggle input { accent-color: var(--fe-accent); }

.fe-m-select {
  font-size: 0.68rem;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  color: var(--fe-text);
  border-radius: 8px;
  padding: 6px 8px;
  flex-shrink: 0;
  max-width: 100px;
  cursor: pointer;
}

.fe-m-icon-btn { flex-shrink: 0; padding: 6px 9px !important; font-size: 0.72rem !important; }

.fe-color-popup {
  position: fixed;
  z-index: 10050;
  width: min(300px, calc(100vw - 20px));
  max-height: min(420px, calc(100vh - 20px));
  overflow: auto;
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(28, 36, 48, 0.14);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.fe-color-popup:not([hidden]) {
  display: block;
}

.fe-color-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.fe-color-popup-inner {
  padding: 4px;
}

.fe-color-popup .fe-color-picker {
  margin-bottom: 0;
  border: none;
  background: transparent;
  padding: 10px;
}

.fe-color-popup .fe-color-grid {
  grid-template-columns: repeat(7, 1fr);
}

body.fe-body.fe-sidebar-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(28, 36, 48, 0.32);
  z-index: 1099;
  pointer-events: auto;
  transition: opacity 0.28s ease;
  animation: feFadeIn 0.28s ease;
}

@keyframes feFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fe-color-picker {
  background: var(--fe-surface);
  border: 1px solid var(--fe-border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.fe-color-picker--compact { padding: 10px; }

.fe-color-current {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.fe-color-current-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--fe-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: default;
  flex-shrink: 0;
}

.fe-eyedropper-inline { flex: 1; justify-content: center; }

.fe-color-section { margin-bottom: 10px; }

.fe-color-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fe-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.fe-color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
}

.fe-color-grid--recent { grid-template-columns: repeat(6, 1fr); }

.fe-palette-swatch {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  min-height: 22px;
  transition: transform 0.1s, border-color 0.1s;
}

.fe-palette-swatch:hover { transform: scale(1.08); border-color: var(--fe-accent-muted); }

.fe-palette-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 1.5px var(--fe-accent);
}

.fe-color-inputs .fe-field span { font-size: 0.72rem; color: var(--fe-muted); }

.fe-rgb-row .fe-field { flex: 1; min-width: 0; }

.fe-rgb-row input { width: 100%; }

.fe-section-tight { padding-top: 0; margin-top: 0; border-top: none; }

.fe-texture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.fe-texture-preview {
  display: block;
  width: 100%;
  max-width: 120px;
  border-radius: 8px;
  border: 1px solid var(--fe-border);
  margin: 8px 0;
  image-rendering: auto;
}

.fe-brush-cursor {
  position: absolute;
  border: 1.5px solid rgba(15, 118, 110, 0.8);
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.fe-brush-preview-canvas {
  display: block;
  width: 100%;
  max-width: 140px;
  border-radius: 8px;
  margin: 8px 0;
  border: 1px solid var(--fe-border);
  background: var(--fe-panel);
}

.fe-brush-preview-lg {
  max-width: 100%;
  margin-bottom: 4px;
}

.fe-toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 36, 48, 0.92);
  color: #f1f5f9;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.8rem;
  z-index: 10001;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(28, 36, 48, 0.2);
  max-width: min(420px, 90vw);
  text-align: center;
}

.fe-brush-presets, .fe-text-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.fe-prop-actions, .fe-nudge-row, .fe-align-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.fe-layer-item.multi { outline: 1px dashed var(--fe-accent); }

.fe-canvas-area { touch-action: none; }
.fe-canvas-area.fe-touch-pan {
  touch-action: pan-x pan-y;
}
.fe-canvas-area:not(.fe-touch-pan) .canvas-container,
.fe-canvas-area:not(.fe-touch-pan) .upper-canvas {
  touch-action: none;
}
.fe-canvas-area.fe-touch-pan .canvas-container,
.fe-canvas-area.fe-touch-pan .upper-canvas {
  touch-action: pan-x pan-y;
}

.fe-ctx-menu {
  z-index: 10000;
}

.fe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 36, 48, 0.4);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.fe-modal-overlay:not([hidden]) { display: flex; }

.fe-modal {
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  color: var(--fe-text);
  box-shadow: 0 16px 40px rgba(28, 36, 48, 0.14);
}

.fe-modal h3 { margin-bottom: 16px; color: var(--fe-text); font-weight: 650; }

.fe-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.fe-progress {
  position: fixed;
  bottom: 0;
  left: 280px;
  right: 0;
  height: 3px;
  background: var(--fe-border);
  z-index: 100;
}

.fe-progress-bar {
  height: 100%;
  background: var(--fe-accent);
  width: 0%;
  transition: width 0.2s;
}

.fe-mobile-only { display: none; }

@media (max-width: 1366px) {
  .fe-panel-right { width: 280px; }
  .fe-panel-left { width: 190px; }
}

.fe-panel-left, .fe-panel-right {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
}

@media (min-width: 1025px) {
  .fe-workspace {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .fe-panel-left,
  .fe-panel-right {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    max-width: none;
  }

  .fe-panel-left { grid-column: 1; }
  .fe-canvas-wrap { grid-column: 2; min-width: 0; overflow: hidden; }
  .fe-panel-right { grid-column: 3; }

  .pe-workspace {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .pe-panel-left,
  .pe-panel-right {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    max-width: none;
  }

  .pe-panel-left { grid-column: 1; }
  .pe-viewer { grid-column: 2; min-width: 0; overflow: hidden; }
  .pe-panel-right { grid-column: 3; }
}

@media (max-width: 1024px) {
  .main-content--fe,
  .main-content--editor,
  .word-editor-body--seo .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
  }
  .fe-panel-left { width: 220px; }
  .fe-panel-right { width: 260px; }
  .fe-topbar-menu .fe-menu-btn { padding: 6px 10px; font-size: 0.78rem; }
  .fe-panel-left .fe-tool-options { display: none; }
  .fe-mobile-burgers { display: flex; }

  body.fe-body .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
  }

  body.fe-body .sidebar.active {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(28, 36, 48, 0.18);
  }

  .fe-panel-left, .fe-panel-right {
    position: fixed;
    top: 52px;
    bottom: 0;
    z-index: 95;
    transform: translateX(-100%);
    box-shadow: none;
    max-width: min(100vw, 280px);
  }
  .fe-panel-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }
  .fe-panel-left.open, .fe-panel-right.open {
    transform: translateX(0);
    box-shadow: 0 8px 32px rgba(28, 36, 48, 0.16);
  }
}

@media (max-width: 900px) {
  .main-content--fe { margin-left: 0; }
  .fe-progress { left: 0; }
  .fe-topbar {
    flex-wrap: nowrap;
    padding: 6px 8px;
    gap: 6px;
    min-height: 44px;
  }
  .fe-topbar-left { gap: 6px; }
  .fe-brand { min-width: 0; flex: 1; }
  .fe-brand-icon { display: none; }
  .fe-brand strong {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
  }
  .fe-meta {
    font-size: 0.62rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .fe-topbar-right { flex-shrink: 0; gap: 4px; }
  .fe-topbar-right .fe-btn-ghost { padding: 6px 8px; font-size: 0.85rem; }
  .fe-topbar-right .fe-btn-accent { padding: 6px 10px; font-size: 0.72rem; }
  .fe-canvas-toolbar {
    padding: 0;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    min-height: auto;
  }
  .fe-mobile-tool-panel {
    order: -1;
    flex: 1 1 100%;
  }
  .fe-mobile-tool-body {
    max-height: min(38vh, 240px);
  }
  .fe-mobile-tool-opts {
    max-height: min(38vh, 240px);
    padding: 6px 8px 8px;
    gap: 5px;
  }
  .fe-m-section {
    padding: 7px 8px;
    border-radius: 8px;
  }
  .fe-m-section-head {
    font-size: 0.58rem;
    margin-bottom: 6px;
  }
  .fe-canvas-toolbar-main {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1 1 100%;
    padding: 6px 8px;
    gap: 6px;
  }
  .fe-canvas-toolbar-main::-webkit-scrollbar { display: none; }
  .fe-canvas-area { padding: 10px; }
  .fe-mobile-only { display: inline-flex; }
  .fe-topbar-menu { display: none; }
  .fe-color-grid { grid-template-columns: repeat(6, 1fr); }
  .fe-color-popup .fe-color-grid { grid-template-columns: repeat(6, 1fr); }
  .fe-m-slider input[type="range"] { width: 64px; }
}

@media (max-width: 380px) {
  .fe-topbar-right .fe-sep { display: none; }
  .fe-topbar-right .fe-btn-ghost#feRedo { display: none; }
  .fe-brand strong { max-width: 34vw; font-size: 0.72rem; }
  .fe-mobile-tool-header { padding: 7px 10px; gap: 8px; }
  .fe-mob-tool-title { font-size: 0.75rem; }
  .fe-mobile-tool-body { max-height: 170px; }
  .fe-mobile-tool-opts { max-height: 170px; padding: 6px 8px 8px; gap: 5px; }
  .fe-m-section { padding: 6px 7px; }
  .fe-m-section-grid { gap: 4px; }
  .fe-m-slider { padding: 4px 6px; gap: 4px; }
  .fe-m-slider-label { display: none; }
  .fe-m-slider input[type="range"] { width: 58px; min-width: 48px; }
  .fe-m-slider-val { font-size: 0.6rem; min-width: 1.4em; }
  .fe-m-toggle { padding: 5px 7px; font-size: 0.62rem; }
  .fe-m-color-btn { width: 30px; height: 30px; }
  .fe-m-select { max-width: 80px; font-size: 0.62rem; padding: 5px 6px; }
  .fe-m-icon-btn { padding: 5px 7px !important; font-size: 0.65rem !important; }
}

@media (max-width: 768px) {
  .seo-content {
    padding: 28px 16px;
    margin-top: 64px;
    overflow-x: hidden;
  }

  .seo-content table {
    border-radius: 8px;
    margin: 20px 0;
  }

  .seo-content th,
  .seo-content td {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}

/* ─── FILEfy Sidebar sections ───────────────────────────────────────────── */

.sidebar-section {
  margin: 4px 8px;
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-section-title {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.sidebar-section-title::-webkit-details-marker { display: none; }

.sidebar-section[open] .sidebar-section-title {
  color: #e2e8f0;
}

.sidebar-section-items .menu-item {
  padding-left: 22px;
  font-size: 0.92rem;
}

.sidebar-telegram {
  margin: 20px 12px 12px;
}

.sidebar-telegram-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #229ED9, #1d8ac2);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(34, 158, 217, 0.3);
}

.sidebar-telegram-icon { font-size: 1.5rem; }

.sidebar-telegram-sub {
  font-size: 0.82rem;
  opacity: 0.9;
  font-weight: 400;
}

/* ─── Converter action bar (chips) ──────────────────────────────────────── */

.fe-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
  align-items: center;
  position: relative;
}

.fe-transfer-wrap {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  max-width: 100%;
}

.fe-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-weight: 500;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  line-height: 1.2;
  white-space: nowrap;
}

.fe-chip-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.fe-chip-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.fe-chip-caret {
  font-size: 0.7rem;
  opacity: 0.55;
  margin-left: -2px;
}

.fe-chip:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.fe-chip-muted {
  color: #475569;
  background: #f8fafc;
}

.fe-chip-accent {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.fe-chip-accent:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.fe-chip-editor {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.fe-chip-editor:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

.fe-chip-primary {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.fe-chip-primary:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.fe-queue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin: 12px 0;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.fe-queue-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #475569;
}

.fe-queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
}

.fe-transfer-dropdown {
  position: relative;
}

.fe-transfer-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  z-index: 100;
  padding: 6px;
}

.fe-transfer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  color: #334155;
}

.fe-transfer-item:hover {
  background: #f1f5f9;
}

.fe-image-check-wrap {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}

.fe-image-check-wrap input {
  width: 18px;
  height: 18px;
  accent-color: #6366f1;
}

.fe-image-card {
  position: relative;
}

.fe-image-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.fe-image-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.fe-image-toolbar-hint {
  font-size: 0.85rem;
  color: #94a3b8;
}

.fe-image-toolbar-actions {
  display: flex;
  gap: 8px;
}

/* ─── Word Editor standalone page ───────────────────────────────────────── */

.word-editor-body {
  overflow-x: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.word-editor-body.word-editor-body--seo {
  overflow-y: auto;
  height: auto;
  min-height: 100vh;
}

.word-editor-body--seo .main-content {
  height: auto;
  overflow-x: hidden;
  overflow-y: visible;
  width: calc(100% - var(--filefy-sb-width, 280px));
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
  box-sizing: border-box;
}

.word-editor-body .main-content {
  max-width: calc(100vw - var(--filefy-sb-width, 280px));
  width: calc(100% - var(--filefy-sb-width, 280px));
  padding: 0;
  margin-left: var(--filefy-sb-width, 280px);
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  transition: margin-left 0.22s ease, width 0.22s ease, max-width 0.22s ease;
}

.we-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  background: #e8ecf0;
  overflow: hidden;
  contain: layout paint;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.we-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: #2b579a;
  border-bottom: 1px solid #1e4b8a;
  flex-shrink: 0;
  z-index: 50;
}

.we-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.we-topbar-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.we-topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.we-workspace-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  contain: layout paint;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.we-workspace-wrap .word-workspace {
  flex: 1;
  min-height: 0;
}

.we-btn {
  padding: 7px 12px;
  border-radius: 4px;
  border: none;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.we-btn-primary {
  background: #fff;
  color: #2b579a;
}

.we-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.we-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.we-btn-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.we-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.we-mobile-toggle {
  display: none;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 768px) {
  .word-editor-body .main-content { margin-left: 0; height: auto; min-height: 0; overflow: visible; }
  .we-app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .we-mobile-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0; }
  .we-topbar { padding: 10px 12px; gap: 8px; }
  .we-topbar-actions { gap: 8px; flex-wrap: nowrap; }
  .we-topbar-actions .we-btn-action { padding: 7px 11px; font-size: 0.82rem; min-height: 36px; }
  .we-topbar-actions .we-btn-label { display: inline; }
  .we-topbar-title { font-size: 0.95rem; max-width: 42vw; }
  .we-workspace-wrap { padding: 0; overflow: hidden; }
  .word-pages-wrap { padding: 0; }
  .word-page { flex-shrink: 0; }
  body.word-editor-body > .mobile-menu-btn {
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    overflow: hidden;
  }
}

/* Image converter hub */
.ic-format-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}

.ic-format-row select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 1rem;
  min-width: 140px;
}

/* ─── Global mobile refinements (v3) ───────────────────────────────────── */

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .main-content {
    padding: 14px 12px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .container {
    padding: 18px 14px;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.45rem;
    line-height: 1.25;
    word-break: break-word;
  }

  h2 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  p, li {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .upload-area {
    padding: 36px 16px;
    margin: 14px 0;
  }

  .upload-area p {
    font-size: 0.95rem;
  }

  button,
  .btn-primary {
    padding: 11px 18px;
    font-size: 0.95rem;
    max-width: 100%;
  }

  .result {
    padding: 14px 12px;
    overflow: visible;
  }

  .fe-transfer-menu--desktop {
    display: none !important;
  }

  .word-tb-text {
    display: inline-flex;
  }

  .word-toolbar-zoom {
    display: flex;
  }

  .word-workspace--mobile .word-page {
    flex-shrink: 0;
    box-sizing: border-box;
  }

  .word-workspace--mobile .word-pages-container {
    padding: 8px 0 20px;
    gap: 16px;
    align-items: center;
    width: auto;
    max-width: none;
  }

  .word-workspace--mobile .word-pages-wrap {
    touch-action: pan-x pan-y pinch-zoom;
    overscroll-behavior: contain;
    background: #94a3b8;
    -webkit-overflow-scrolling: touch;
  }

  .word-workspace--mobile .word-viewport-toolbar {
    padding: 5px 8px;
    gap: 5px;
    justify-content: center;
  }

  .word-workspace--mobile .word-vc-label--hand {
    display: inline;
  }

  .word-workspace--mobile.word-hand-mode .word-vc-label--hand {
    color: #a5b4fc;
  }

  .word-workspace--mobile .word-vc-btn {
    min-width: 36px;
    height: 36px;
  }

  .word-workspace--mobile .word-header {
    flex-wrap: nowrap;
    padding: 6px 10px;
    gap: 8px;
  }

  .word-workspace--mobile .word-file-info {
    flex: 1;
    min-width: 0;
  }

  .word-workspace--mobile .word-file-name {
    font-size: 0.82rem;
  }

  .word-workspace--mobile .word-file-meta {
    font-size: 0.68rem;
  }

  .word-workspace--mobile .word-header-actions {
    width: auto;
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
  }

  .word-workspace--mobile .word-header-actions .btn-word-action-sm {
    padding: 6px 10px;
    font-size: 0.78rem;
    min-height: 34px;
    border-radius: 6px;
  }

  .word-workspace--mobile .word-header-actions [data-action="print"] {
    display: none;
  }

  .fe-panel-left,
  .fe-panel-right {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 48px;
    bottom: 0;
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: min(92vw, 300px);
    box-shadow: none;
  }

  .fe-panel-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }

  .fe-panel-left.open,
  .fe-panel-right.open {
    transform: translateX(0);
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.2);
  }

  .pe-panel-left,
  .pe-panel-right {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 48px;
    bottom: calc(52px + env(safe-area-inset-bottom, 0));
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: min(92vw, 300px);
    box-shadow: none;
  }

  .pe-panel-right {
    right: 0;
    left: auto;
    transform: translateX(100%);
  }

  .pe-panel-left.open,
  .pe-panel-right.open {
    transform: translateX(0);
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.2);
  }

  body.fe-panel-open::before,
  body.pe-panel-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 1100;
    pointer-events: auto;
  }

  .fe-workspace,
  .pe-workspace {
    display: flex !important;
    flex-direction: column !important;
  }

  .fe-canvas-wrap,
  .pe-viewer {
    flex: 1;
    min-width: 0;
    min-height: 0;
  }

  .word-autosave-status {
    display: none;
  }

  .pe-mobile-bottom-bar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  }

  .pe-mobile-tool-body {
    max-height: min(45vh, 320px);
  }

  .fe-mobile-tool-panel .fe-mobile-tool-body {
    max-height: min(45vh, 320px);
  }

  .seo-content {
    margin-top: 40px;
    padding: 24px 16px;
    border-radius: 16px;
  }

  .seo-content h2 {
    font-size: 1.25rem;
  }

  .fe-action-bar {
    gap: 6px;
    margin: 10px 0;
  }

  .fe-chip {
    padding: 7px 11px;
    font-size: 0.8rem;
    white-space: normal;
    text-align: left;
    max-width: 100%;
  }

  .fe-queue-banner {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .ic-format-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ic-format-row select {
    width: 100%;
    min-width: 0;
  }

  .word-workspace {
    border-radius: 0;
    margin-bottom: 0;
  }

  .word-pages-wrap {
    max-height: none;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    padding: 0;
  }

  .word-pages-container {
    padding: 8px 0 24px;
    gap: 16px;
  }

  .word-workspace--mobile .word-page {
    flex-shrink: 0;
  }

  .page-header,
  .page-footer {
    padding: 6px 14px;
    font-size: 8pt;
  }

  .page-content {
    font-size: 11pt;
  }

  .word-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .word-header-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-word-download,
  .btn-word-secondary {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .word-toolbar-row {
    padding: 4px 6px;
  }

  .mobile-menu-btn {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }

  .pe-canvas-area {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0;
    display: block;
  }
  .pe-canvas-area:not(.pe-touch-pan) {
    touch-action: none;
  }
  .pe-canvas-area.pe-touch-pan {
    touch-action: pan-x pan-y;
  }

  .fe-canvas-area {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0;
    display: block;
  }
  .fe-canvas-area:not(.fe-touch-pan) {
    touch-action: none;
  }
  .fe-canvas-area.fe-touch-pan {
    touch-action: pan-x pan-y;
  }

  .pdf-editor-body,
  .fe-body,
  .word-editor-body,
  .pdf-editor-body--seo,
  .fe-body--seo,
  .word-editor-body--seo {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .pe-app,
  .fe-app,
  .we-app {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .pe-mob-tool-btn {
    min-width: 48px;
    padding: 8px 6px;
  }

  .word-tb-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .word-toolbar {
    padding: 6px 4px;
    gap: 2px;
  }

  .word-pages-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .pe-panel-left,
  .pe-panel-right,
  .fe-panel-left,
  .fe-panel-right {
    max-width: 100vw;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 10px 8px;
  }

  .container {
    padding: 14px 10px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.28rem;
  }

  .upload-area {
    padding: 28px 12px;
  }

  .seo-content {
    padding: 18px 12px;
  }

  .fe-chip {
    font-size: 0.76rem;
    padding: 6px 10px;
  }

  .we-workspace-wrap {
    padding: 0;
    overflow: hidden;
  }

  .we-topbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .we-topbar-title {
    font-size: 0.85rem;
  }
}

/* ─── Mobile sheets (converter + Word) ─────────────────────────────────── */

.fe-mobile-sheet-overlay,
.word-mobile-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fe-sheet-fade 0.2s ease;
}

.fe-mobile-sheet,
.word-mobile-sheet {
  width: 100%;
  max-width: 520px;
  max-height: min(85vh, 640px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fe-mobile-sheet-handle {
  width: 40px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 99px;
  margin: 0 auto 12px;
}

.fe-mobile-sheet-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  font-family: 'DM Sans', system-ui, sans-serif;
}

.fe-mobile-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fe-mobile-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px;
  border: none;
  background: #f8fafc;
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  color: #334155;
  text-align: left;
  cursor: pointer;
}

.fe-mobile-sheet-item:active {
  background: #e2e8f0;
}

.fe-mobile-sheet-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.fe-mobile-sheet-body {
  max-height: min(55vh, 420px);
  overflow-y: auto;
  padding: 4px 0 8px;
}

.fe-mobile-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 4px;
}

.fe-mobile-tool-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 0.72rem;
  color: #334155;
  cursor: pointer;
  text-align: center;
  min-height: 68px;
}

.fe-mobile-tool-pick:active,
.fe-mobile-tool-pick.active {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
}

.fe-mobile-tool-pick .fe-mobile-sheet-icon {
  font-size: 1.35rem;
}

.fe-mobile-props-host {
  max-height: min(55vh, 420px);
  overflow-y: auto;
  padding: 0 4px;
}

.fe-mobile-sheet-close {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}

body.fe-sheet-open,
body.word-sheet-open {
  overflow: hidden;
}

@keyframes fe-sheet-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Word mobile tool panels (bottom sheet) */
.word-m-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-m-section {
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e8eef4;
}

.word-m-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.word-m-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.word-m-select {
  flex: 1;
  min-width: 0;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.78rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.word-m-select--sm {
  flex: 0 0 56px;
  max-width: 56px;
}

.word-m-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.word-m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.word-m-btn--active {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
}

.word-m-btn--text {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0 10px;
}

.word-m-styles {
  gap: 4px;
}

.word-m-styles .word-style-quick {
  min-width: 44px;
  min-height: 44px;
  padding: 3px 4px;
}

.word-m-more {
  min-height: 44px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.word-m-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.word-m-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 8px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.word-m-tile:active {
  border-color: #2b579a;
  box-shadow: 0 2px 8px rgba(43, 87, 154, 0.12);
}

.word-m-tile-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.word-m-tile-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  line-height: 1.15;
}

.word-m-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.word-m-zoom-label {
  min-width: 40px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.word-m-design-grid {
  grid-template-columns: repeat(4, 1fr);
  max-width: none;
}

.word-mobile-sheet-tools .word-m-panel {
  gap: 8px;
}

.word-mobile-sheet-tools {
  max-height: min(62vh, 520px);
}

.word-mobile-bar {
  display: none;
  flex-shrink: 0;
  gap: 2px;
  padding: 4px 6px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  grid-template-columns: repeat(4, 1fr);
}

.word-mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.15s, color 0.15s;
}

.word-mobile-tab-icon {
  font-size: 0.95rem;
  line-height: 1;
  color: #64748b;
}

.word-mobile-tab-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.1;
  text-align: center;
}

.word-mobile-tab--active {
  background: #eff6ff;
}

.word-mobile-tab--active .word-mobile-tab-icon,
.word-mobile-tab--active .word-mobile-tab-label {
  color: #2b579a;
}

.word-mobile-quick {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.word-mobile-quick::-webkit-scrollbar { display: none; }

.word-mobile-quick-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.word-mobile-quick-sep {
  width: 1px;
  height: 28px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.word-mobile-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.word-mobile-quick-btn:active {
  background: #eff6ff;
  border-color: #2b579a;
}

.word-mobile-sheet-empty {
  margin: 0;
  padding: 16px 8px;
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
}

.word-mobile-sheet-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 12px;
  max-height: min(58vh, 480px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.word-mobile-sheet-tools .word-toolbar-row {
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 0;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.word-mobile-sheet-tools .word-ribbon-card {
  width: 100%;
  align-items: stretch;
  padding: 12px;
  border-radius: 12px;
  box-sizing: border-box;
}

.word-mobile-sheet-tools .word-ribbon-card-body {
  width: 100%;
}

.word-mobile-sheet-tools .word-toolbar-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.word-mobile-sheet-tools .word-toolbar-group {
  flex-wrap: wrap;
  gap: 8px;
}

.word-mobile-sheet-tools .word-toolbar-group--row {
  gap: 8px;
}

.word-mobile-sheet-tools .word-tb-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.word-mobile-sheet-tools .word-tb-text {
  display: inline-flex;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.word-mobile-sheet-tools .word-tb-select {
  min-height: 36px;
  font-size: 0.8rem;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  max-width: none;
}

.word-mobile-sheet-tools .word-tb-compact {
  max-width: none;
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
}

.word-mobile-sheet-tools .word-tb-font {
  flex: 1 1 100%;
  min-width: 0;
}

.word-mobile-sheet-tools .word-tb-size {
  flex: 0 0 72px;
}

.word-mobile-sheet-tools .word-style-inline {
  gap: 8px;
}

.word-mobile-sheet-tools .word-style-quick,
.word-mobile-sheet-tools .word-style-more-btn {
  min-height: 56px;
}

.word-mobile-sheet-tools .word-design-grid {
  max-width: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.word-mobile-sheet-tools .word-design-card {
  min-height: 72px;
  padding: 10px 6px;
}

.word-mobile-sheet-tools .word-design-swatch,
.word-mobile-sheet-tools .word-design-icon,
.word-mobile-sheet-tools .word-design-preview-img {
  width: 40px;
  height: 40px;
}

.word-mobile-sheet-tools .word-design-card-label {
  font-size: 0.72rem;
}

.word-mobile-sheet-tools--layout .word-toolbar-section {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.word-mobile-sheet-tools--layout .word-toolbar-group {
  flex-wrap: wrap;
}

.word-mobile-sheet-tools--insert .word-toolbar-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.word-mobile-sheet-tools--insert .word-tb-text {
  width: 100%;
  justify-content: center;
}

.word-mobile-sheet-section {
  width: 100%;
  margin-bottom: 12px;
}

.word-mobile-sheet-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .word-mobile-bar {
    display: grid;
  }

  .word-ribbon .word-ribbon-tabs,
  .word-ribbon > .word-toolbar {
    display: none !important;
  }

  .word-ribbon {
    border-bottom: none;
    background: transparent;
    min-height: 0;
  }

  .word-workspace--mobile .word-header {
    border-bottom: 1px solid #e2e8f0;
  }

  .word-workspace--mobile .word-body-layout {
    position: relative;
  }

  .word-workspace--mobile .word-nav-panel {
    display: none;
  }

  .fe-chip-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pe-mob-tool-label {
    font-size: 0.58rem;
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pe-mobile-bottom-scroll {
    scroll-snap-type: x proximity;
    padding: 0 4px;
  }

  .pe-mob-tool-btn {
    scroll-snap-align: start;
  }

  .main-content--editor,
  .main-content--fe {
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
  }
}

@media (min-width: 769px) {
  .word-mobile-bar {
    display: none !important;
  }

  .word-ribbon .word-ribbon-tabs {
    display: flex !important;
  }

  .word-ribbon > .word-toolbar {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .fe-transfer-wrap .fe-transfer-menu--desktop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    z-index: 100;
    padding: 6px;
  }
}

/* ─── Product guide (coach marks) ───────────────────────────────────────── */
.filefy-guide-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.filefy-guide-title-wrap > h1 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
.filefy-guide-help {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #94a3b8;
  background: #fff;
  color: #475569;
  cursor: pointer;
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  vertical-align: middle;
}
.filefy-guide-help-icon {
  display: block;
  flex-shrink: 0;
}
.filefy-guide-help:hover {
  border-color: #0ea5e9;
  color: #0284c7;
  background: #f0f9ff;
}
.word-topbar .filefy-guide-help,
.pe-topbar .filefy-guide-help,
.fe-topbar .filefy-guide-help,
.we-header .filefy-guide-help {
  margin-left: 8px;
}
.filefy-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 100040;
  pointer-events: none;
}
.filefy-guide-overlay:not([hidden]) {
  pointer-events: none;
}
.filefy-guide-spotlight {
  position: fixed;
  border-radius: 12px;
  border: 2px solid #0ea5e9;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.48);
  pointer-events: none;
  z-index: 100041;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}
.filefy-guide-spotlight--sidebar {
  border-radius: 0 14px 14px 0;
  border-left: none;
}
.filefy-guide-card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  top: auto;
  width: min(380px, calc(100vw - 24px));
  max-height: min(40vh, 320px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
  /* Must beat sidebar (.active ~1100) and any guide-target elevation */
  z-index: 100060 !important;
  pointer-events: auto;
  border: 1px solid #e2e8f0;
}
.filefy-guide-card[hidden] {
  display: none !important;
}
.filefy-guide-progress {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
  font-weight: 500;
}
.filefy-guide-title {
  margin: 0 0 8px;
  font-size: 17px;
  color: #0f172a;
  font-weight: 700;
}
.filefy-guide-text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #475569;
}
.filefy-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 4px;
}
.filefy-guide-btn {
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.filefy-guide-btn--ghost {
  background: transparent;
  border-color: #cbd5e1;
  color: #64748b;
}
.filefy-guide-btn--ghost:hover {
  background: #f8fafc;
}
.filefy-guide-btn--primary {
  background: #0ea5e9;
  color: #fff;
}
.filefy-guide-btn--primary:hover {
  background: #0284c7;
}
.filefy-guide-target {
  /* Do NOT raise z-index here — that pulls targets above the guide card */
  border-radius: 8px;
  outline: none;
}
body.filefy-guide-open {
  /* Allow scroll so user can dismiss by scrolling; spotlight updates stop on dismiss */
  overscroll-behavior: contain;
}
body.filefy-guide-scrolling {
  overflow: auto !important;
}
/* Sidebar full height while guide highlights it */
body.filefy-guide-sidebar-step #siteSidebar.sidebar,
body.filefy-guide-open #siteSidebar.sidebar.filefy-guide-sidebar-open,
body.filefy-guide-open #siteSidebar.sidebar.active {
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 100045 !important; /* above dimmer, BELOW guide card (100060) */
}
@media (max-width: 768px) {
  .filefy-guide-card {
    width: calc(100vw - 20px) !important;
    max-height: min(34dvh, 260px) !important;
    bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
  }
  .filefy-guide-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-bottom: 2px;
  }
  .filefy-guide-title-wrap {
    margin-bottom: 16px;
    gap: 6px;
  }
  .filefy-guide-help {
    width: 30px;
    height: 30px;
  }
  .filefy-guide-help-icon {
    width: 16px;
    height: 16px;
  }
}

.word-m-btn.word-m-btn--active,
.word-m-btn.word-tb-active {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

/* ─── Converter locked panels + upload redirect ─────────────────────────── */
.upload-area {
  position: relative;
}
.upload-redirect {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.upload-redirect:hover {
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.08);
  opacity: 1;
}
.upload-redirect.is-visible {
  display: inline-flex;
}
.upload-file-meta {
  margin-top: 12px;
  font-size: 0.92rem;
  color: #475569;
  display: none;
  text-align: center;
}
.upload-file-meta.is-visible {
  display: block;
}
.upload-file-meta strong {
  color: #0f172a;
  font-weight: 600;
}

.converter-panel {
  margin: 18px 0 8px;
  padding: 18px 18px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.converter-panel.is-locked {
  opacity: 0.58;
  filter: grayscale(0.12);
  position: relative;
}
.converter-panel.is-locked::after {
  content: attr(data-lock-hint);
  display: block;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}
.converter-panel.is-locked .btn-primary,
.converter-panel.is-locked button.btn-primary,
.converter-panel.is-locked input,
.converter-panel.is-locked select {
  pointer-events: none;
}
.converter-panel.is-ready {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}
.converter-panel.is-ready::after {
  display: none;
}
.converter-panel-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}
.converter-panel-hint {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #64748b;
}
.converter-panel .btn-primary:disabled,
.converter-panel button:disabled {
  background: #94a3b8 !important;
  cursor: not-allowed;
  opacity: 0.9;
}
@media (max-width: 768px) {
  .converter-panel {
    margin: 12px 0 6px;
    padding: 12px 14px 12px;
  }
  .converter-panel-hint,
  .converter-feature-list,
  .converter-panel.is-ready .converter-panel-hint,
  .converter-panel.is-ready .converter-feature-list {
    display: none;
  }
  .converter-panel-title {
    font-size: 0.95rem;
    margin: 0 0 10px;
  }
  .converter-panel.is-locked::after {
    font-size: 0.8rem;
    margin-top: 8px;
  }
}
.converter-queue-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.92rem;
  margin-bottom: 12px;
  background: #fff;
}
.converter-feature-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: #475569;
  font-size: 0.92rem;
}
.converter-feature-list li {
  margin-bottom: 4px;
}

/* —— FILEfy Image Lab + compare + next-steps —— */
.ff-lab-body {
  --ff-lab-accent: #0f766e;
  --ff-lab-accent-soft: #ccfbf1;
  --ff-lab-ink: #0f172a;
  --ff-lab-muted: #64748b;
}
.ff-lab {
  max-width: none;
}
.ff-lab-hero {
  margin: 8px 0 22px;
  padding: 20px 22px;
  border-radius: 18px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(15, 118, 110, 0.12), transparent 55%),
    radial-gradient(90% 70% at 100% 10%, rgba(14, 165, 233, 0.1), transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px solid #e2e8f0;
}
.ff-lab-eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ff-lab-accent);
}
.ff-lab-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.2;
  color: var(--ff-lab-ink);
}
.ff-lab-lead {
  margin: 0;
  color: var(--ff-lab-muted);
  font-size: 1.02rem;
  max-width: 36em;
}
.ff-lab-upload {
  border-style: dashed;
  border-color: #99f6e4;
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 70%);
}
.ff-lab-upload-title {
  margin: 0 0 10px;
  color: #334155;
  font-weight: 500;
}
.ff-lab-status {
  margin: 12px 0 0;
  color: var(--ff-lab-muted);
  font-size: 0.92rem;
}
.ff-lab-panel {
  margin-top: 16px;
}
.ff-lab-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 14px;
  margin-bottom: 14px;
}
.ff-lab-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
}
.ff-lab-field input[type="number"],
.ff-lab-field input[type="text"],
.ff-lab-field select {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font: inherit;
  color: #0f172a;
  background: #fff;
}
.ff-lab-field input[type="range"] {
  width: 100%;
  accent-color: var(--ff-lab-accent);
}
.ff-lab-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #334155;
  margin-top: 18px;
}
.ff-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.ff-preset {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ff-preset:hover,
.ff-preset.is-active {
  background: var(--ff-lab-accent-soft);
  border-color: #5eead4;
  color: #115e59;
}
.ff-lab-workspace {
  margin-top: 18px;
}
.ff-lab-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ff-stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.ff-stat span {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ff-stat strong {
  font-size: 1.05rem;
  color: #0f172a;
}
.ff-stat strong.is-good {
  color: #047857;
}
.ff-lab-compare-host {
  margin-bottom: 16px;
}
.ff-lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

/* Compare slider */
.ff-compare-wrap,
.ff-compare {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 16px;
}
.ff-compare {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #0f172a;
  user-select: none;
  touch-action: none;
}
.ff-compare-stage {
  position: relative;
  overflow: hidden;
  cursor: ew-resize;
  line-height: 0;
}
.ff-compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  background: transparent;
}
.ff-compare-before-wrap {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  overflow: hidden;
  z-index: 1;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}
.ff-compare-stage > .ff-compare-img--after {
  z-index: 0;
}
.ff-compare-before-wrap .ff-compare-img--before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  max-width: none;
  object-fit: fill;
}
.ff-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 44px;
  margin-left: -22px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.ff-compare-handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25);
}
.ff-compare-handle-knob {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
.ff-compare.is-dragging .ff-compare-handle-knob {
  transform: scale(1.06);
}
.ff-compare-tag {
  position: absolute;
  bottom: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(6px);
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ff-compare-tag--before { left: 12px; }
.ff-compare-tag--after { right: 12px; }

@media (max-width: 640px) {
  .ff-lab-hero {
    padding: 16px;
    border-radius: 14px;
  }
  .ff-lab-controls {
    grid-template-columns: 1fr 1fr;
  }
}

/* Live preview / resize / crop / studio */
.ff-live-preview { margin: 16px 0; }
.ff-live-frame {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff;
  text-align: center;
}
.ff-live-frame img {
  display: block;
  width: auto;
  max-width: min(100%, 920px);
  max-height: min(58vh, 520px);
  margin: 0 auto;
  object-fit: contain;
}
.ff-live-caption {
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  text-align: left;
}
.ff-checker {
  background-color: #f1f5f9;
  background-image:
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.ff-lab-controls--resize {
  grid-template-columns: 1fr;
}
.ff-size-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ff-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  grid-column: 1 / -1;
}
.ff-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.ff-lab-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
}
.ff-lab-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.ff-lab-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.ff-stats { /* alias used by older HTML */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.ff-field { /* alias */
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
}
.ff-check { /* alias */
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #334155;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
.ff-crop-stage {
  margin: 16px 0;
  display: flex;
  justify-content: center;
  background: #0f172a;
  border-radius: 16px;
  padding: 12px;
  overflow: auto;
}
.ff-crop-canvas {
  max-width: 100%;
  touch-action: none;
  cursor: crosshair;
  border-radius: 8px;
}
.ff-studio {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 40%);
}
.converter-panel-hint {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 0.9rem;
}
.ff-result-card {
  margin: 0;
  max-width: none;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.ff-result-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  margin: 16px 0 0;
  max-width: 960px;
}
.ff-result-visual {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.ff-result-side {
  flex: 0 1 280px;
  min-width: 220px;
  max-width: 340px;
}
.ff-result-layout:not(:has(.ff-result-visual)) .ff-result-side {
  flex: 1 1 auto;
  max-width: 420px;
}
.ff-result-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.ff-result-primary {
  width: 100%;
  justify-content: center;
  text-align: center;
}
.ff-result-editor {
  width: 100%;
  justify-content: center;
}
.ff-result-editor:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ff-result-more {
  margin-top: 12px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}
.ff-result-more summary {
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  list-style: none;
}
.ff-result-more summary::-webkit-details-marker {
  display: none;
}
.ff-result-more summary::after {
  content: '▾';
  margin-left: 8px;
  font-size: 0.85em;
  color: #64748b;
}
.ff-result-more[open] summary::after {
  content: '▴';
}
.ff-result-more .fe-action-bar {
  margin-top: 12px;
}
.ff-result-preview {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff;
  line-height: 0;
}
.ff-result-preview img {
  display: block;
  width: auto;
  max-width: min(100%, 560px);
  max-height: min(58vh, 480px);
  margin: 0 auto;
}
.ff-result-note,
.ff-result-meta {
  max-width: none;
  margin: 12px 0 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.5;
}
.ff-result-meta ol {
  margin: 8px 0 0 18px;
}
@media (max-width: 640px) {
  .ff-size-row { grid-template-columns: 1fr; }
  .ff-lab-controls { grid-template-columns: 1fr; }
  .ff-result-layout {
    flex-direction: column;
  }
  .ff-result-side {
    max-width: none;
    width: 100%;
  }
  .ff-result-main {
    flex-direction: column;
    align-items: stretch;
  }
  .ff-result-primary,
  .ff-result-editor {
    width: 100%;
    justify-content: center;
  }
}

/* ===== FILEfy Photo Editor — PS-like chrome (B–F) ===== */
.fe-options-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--fe-border);
  background: var(--fe-surface);
  flex-shrink: 0;
}
.fe-options-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fe-muted);
  font-weight: 600;
}
.fe-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.78rem;
  color: var(--fe-muted);
  border-top: 1px solid var(--fe-border);
  background: var(--fe-panel);
  flex-shrink: 0;
}
.fe-status-hint { margin-left: auto; opacity: 0.7; }
.fe-tool-group { position: relative; }
.fe-tool-caret, .fe-tool-label { pointer-events: none; }
.fe-tool-caret { pointer-events: auto; margin-left: auto; opacity: 0.6; font-size: 0.7em; }
.fe-tool-flyout {
  position: absolute;
  left: calc(100% + 6px);
  top: 0;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--fe-border);
  background: var(--fe-panel);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}
.fe-tool-flyout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.fe-tool-flyout-item:hover { background: var(--fe-accent-soft); }
.fe-tool-flyout-item kbd {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.55;
}
.fe-tool-actions { margin-top: 8px; border-top: 1px solid var(--fe-border); padding-top: 8px; }
.fe-curves-canvas {
  width: 100%;
  max-width: 220px;
  border-radius: 8px;
  cursor: crosshair;
  border: 1px solid var(--fe-border);
}
.fe-command-palette {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.fe-command-dialog {
  width: min(520px, 92vw);
  background: var(--fe-panel);
  border: 1px solid var(--fe-border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  overflow: hidden;
}
.fe-command-dialog input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--fe-border);
  padding: 14px 16px;
  font: inherit;
  font-size: 1.05rem;
  background: transparent;
  color: var(--fe-text);
  outline: none;
}
.fe-command-list { max-height: 360px; overflow: auto; padding: 6px; }
.fe-command-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.fe-command-item:hover { background: var(--fe-accent-soft); }
.fe-command-item kbd { margin-left: auto; font-size: 0.75rem; opacity: 0.55; }
.fe-confirm-overlay { z-index: 10001; }
.fe-confirm-msg { margin: 8px 0 16px; color: var(--fe-muted); line-height: 1.45; }
.fe-btn-danger { background: #dc2626 !important; color: #fff !important; }
.fe-toast[data-type="error"] { background: #7f1d1d; }
.fe-mobile-dock {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(15, 17, 23, 0.94);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}
.fe-mobile-dock button {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e2e8f0;
  font-size: 1.15rem;
  box-shadow: none;
}
.fe-mobile-dock button:hover { transform: none; background: rgba(255,255,255,0.08); }

@media (max-width: 768px) {
  .fe-mobile-dock { display: flex; }
  .fe-app { padding-bottom: 56px; }
  .fe-options-bar { display: none; }
}

/* Dark theme default for photo editor */
body[data-fe-theme="dark"] .fe-app {
  --fe-bg: #0f1117;
  --fe-panel: #171a22;
  --fe-surface: #12141b;
  --fe-accent: #2dd4bf;
  --fe-accent-hover: #5eead4;
  --fe-accent-soft: rgba(45, 212, 191, 0.12);
  --fe-text: #e8eaed;
  --fe-muted: #94a3b8;
  --fe-border: #2a2f3a;
  --fe-border-strong: #3b4252;
  --fe-canvas: #0b0d12;
}
body[data-fe-theme="dark"] .fe-tool.active,
body[data-fe-theme="dark"] .fe-tab.active {
  background: var(--fe-accent-soft);
  color: var(--fe-accent);
}
body[data-fe-theme="light"] .fe-app {
  --fe-bg: #f1f2f4;
  --fe-panel: #ffffff;
  --fe-surface: #f7f8f9;
  --fe-accent: #0f766e;
  --fe-accent-hover: #0d9488;
  --fe-accent-soft: rgba(15, 118, 110, 0.1);
  --fe-text: #1c2430;
  --fe-muted: #64748b;
  --fe-border: #e2e5ea;
  --fe-canvas: #e6e8ec;
}

/* === FILEfy Pro Nav Shell =============================================== */

.sb-ico {
  width: 18px;
  height: 18px;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
.sb-ico svg { width: 100%; height: 100%; display: block; }

.sb-shell {
  padding: 12px 10px 20px;
  gap: 4px;
}

.sb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(148,163,184,.12);
  margin-bottom: 10px;
}

.sb-shell .logo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f8fafc;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
  min-width: 0;
}

.sb-brand { letter-spacing: -0.02em; }

.sb-toggle {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(148,163,184,.12);
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
}
.sb-toggle:hover { background: rgba(148,163,184,.22); transform: none; }

.sb-search { position: relative; margin: 0 4px 10px; }
.sb-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15,23,42,.65);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 10px;
  padding: 8px 10px;
}
.sb-search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #f1f5f9;
  font: inherit;
  font-size: 13px;
  outline: none;
}
.sb-search-box input::placeholder { color: #64748b; }
.sb-kbd {
  font-size: 10px;
  color: #64748b;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, monospace;
}
.sb-search-results {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  background: #1e2937;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  max-height: 320px;
  overflow: auto;
  padding: 6px;
}
.sb-search-hit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  color: #e2e8f0;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
}
.sb-search-hit:hover { background: #334155; }

.sb-block { margin: 6px 2px 10px; }
.sb-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #64748b;
}
.sb-block--collapsible > .sb-block-title {
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
}
.sb-block--collapsible > .sb-block-title::-webkit-details-marker { display: none; }
.sb-block--collapsible[open] > .sb-block-title { color: #94a3b8; background: rgba(148,163,184,.06); }
.sb-block--collapsible > .sb-block-title:hover { color: #e2e8f0; background: rgba(148,163,184,.08); }
.sb-block-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.sb-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: #cbd5e1;
  cursor: pointer;
  border-radius: 9px;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
  text-decoration: none;
  position: relative;
  font-size: 0.9rem;
}
.menu-item:hover,
.menu-item.active {
  background: #1e293b;
  color: #fff;
  transform: none;
}
.menu-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.08));
  box-shadow: inset 3px 0 0 #818cf8;
}
.sb-fav-btn,
.sb-remove-btn {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  box-shadow: none;
  flex-shrink: 0;
}
.sb-remove-btn { margin-left: 0; }
.sb-remove-btn + .sb-fav-btn { margin-left: 0; }
.menu-item:hover .sb-fav-btn,
.menu-item:hover .sb-remove-btn,
.menu-item.is-fav .sb-fav-btn { opacity: 1; }
.menu-item.is-fav .sb-fav-btn { color: #fbbf24; }
.sb-fav-btn:hover { background: rgba(148,163,184,.15); transform: none; color: #fbbf24; }
.sb-remove-btn:hover { background: rgba(248,113,113,.18); transform: none; color: #fca5a5; }
.sb-remove-btn .sb-ico { width: 14px; height: 14px; }

.sidebar-section {
  margin: 2px 0;
  border-radius: 10px;
  overflow: visible;
}
.sidebar-section-title {
  list-style: none;
  cursor: pointer;
  padding: 10px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
}
.sidebar-section-title::-webkit-details-marker { display: none; }
.sidebar-section[open] .sidebar-section-title { color: #e2e8f0; background: rgba(148,163,184,.06); }
.sidebar-section-items .menu-item { padding-left: 12px; }

.sidebar-telegram { margin: 16px 4px 8px; margin-top: auto; }
.sidebar-telegram-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  background: rgba(148,163,184,.06);
}
.sidebar-telegram-link:hover { background: rgba(148,163,184,.12); color: #fff; }
.sidebar-telegram-sub { font-size: 11px; color: #64748b; }

/* Compact rail */
body.sb-compact {
  --filefy-sb-width: 72px;
}
body.sb-compact .sidebar {
  width: var(--filefy-sb-width, 72px);
  padding: 10px 8px 16px;
}
body.sb-compact .main-content,
body.sb-compact .main-content--fe,
body.sb-compact .main-content--editor,
body.sb-compact .word-editor-body .main-content {
  margin-left: var(--filefy-sb-width, 72px);
  width: calc(100% - var(--filefy-sb-width, 72px));
  max-width: calc(100vw - var(--filefy-sb-width, 72px));
}
body.sb-compact .sb-label,
body.sb-compact .sb-kbd,
body.sb-compact .sb-fav-btn,
body.sb-compact .sb-remove-btn,
body.sb-compact .sb-search-box input,
body.sb-compact .sidebar-telegram-sub {
  display: none !important;
}
body.sb-compact .sb-search-box { justify-content: center; padding: 10px; }
body.sb-compact .sb-head { justify-content: center; flex-direction: column; }
body.sb-compact .sb-shell .logo { justify-content: center; }
body.sb-compact .menu-item { justify-content: center; padding: 12px 8px; }
body.sb-compact .sidebar-section-title { justify-content: center; }
body.sb-compact .sb-block-title { justify-content: center; }
body.sb-compact .menu-item:hover::after,
body.sb-compact .sidebar-section-title:hover::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e2937;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 50;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  pointer-events: none;
}
body.sb-compact .menu-item { position: relative; }

/* Mobile dock */
.fy-mobile-dock {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 120;
  background: rgba(15,23,42,.96);
  border-top: 1px solid rgba(148,163,184,.2);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.fy-mobile-dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 0;
  color: #94a3b8;
  font-size: 10px;
  padding: 8px 4px;
  border-radius: 10px;
  box-shadow: none;
  font-weight: 600;
}
.fy-mobile-dock button.active,
.fy-mobile-dock button:hover {
  color: #fff;
  background: rgba(99,102,241,.25);
  transform: none;
}
.fy-mobile-dock .sb-ico { width: 20px; height: 20px; }

@media (max-width: 900px) {
  body.sb-compact {
    --filefy-sb-width: 280px;
  }
  body.sb-compact .sidebar { width: 280px; }
  body.sb-compact .main-content,
  body.sb-compact .main-content--fe,
  body.sb-compact .main-content--editor,
  body.sb-compact .word-editor-body .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
  }
  .fy-mobile-dock { display: grid; }
  body { padding-bottom: 64px; }
  .sb-toggle { display: none; }

  /* Full-screen editors: no site mobile dock over the workspace */
  body.fy-editor-workspace,
  body[data-page="photo-editor"],
  body[data-page="pdf-editor"],
  body[data-page="word-editor"],
  body.fe-body--ps,
  body.pdf-editor-body,
  body.word-editor-body {
    padding-bottom: 0 !important;
  }
  body.fy-editor-workspace .fy-mobile-dock,
  body[data-page="photo-editor"] .fy-mobile-dock,
  body[data-page="pdf-editor"] .fy-mobile-dock,
  body[data-page="word-editor"] .fy-mobile-dock,
  body.fe-body--ps .fy-mobile-dock,
  body.pdf-editor-body .fy-mobile-dock,
  body.word-editor-body .fy-mobile-dock,
  #filefyMobileDock.fy-editor-hidden {
    display: none !important;
  }
}

@media (min-width: 901px) {
  .fy-mobile-dock { display: none !important; }
}

/* —— Video Lab workspace (constrained preview + two-col) —— */
.ff-video-lab .ff-lab {
  max-width: 1080px;
}
.ff-video-lab .vl-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
  gap: 18px;
  align-items: start;
  margin-top: 8px;
}
.ff-video-lab .vl-stage-col,
.ff-video-lab .vl-side-col {
  min-width: 0;
}
.ff-video-lab .upload-area {
  padding: 28px 20px 20px;
  margin: 0;
}
.ff-video-lab .upload-area.has-file {
  padding-top: 16px;
}
.ff-video-lab .vl-preview-stage {
  display: none;
  margin: 14px auto 8px;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  max-height: min(420px, 48vh);
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #1e2937;
  position: relative;
}
.ff-video-lab .vl-preview-stage.is-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ff-video-lab #vlPreview,
.ff-video-lab .vl-preview-stage video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #0f172a;
}
.ff-video-lab .vl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 10px 0 0;
}
.ff-video-lab .vl-meta span {
  font-size: 0.78rem;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 10px;
}
.ff-video-lab .vl-progress {
  display: none;
  margin-top: 12px;
}
.ff-video-lab .vl-progress.is-on {
  display: block;
}
.ff-video-lab .vl-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.ff-video-lab .vl-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  transition: width 0.2s ease;
}
.ff-video-lab .vl-progress-label {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #64748b;
}
.ff-video-lab .ff-lab-panel {
  margin-top: 0;
  position: sticky;
  top: 16px;
}
.ff-video-lab .vl-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ff-video-lab .vl-preset {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
.ff-video-lab .vl-preset:hover,
.ff-video-lab .vl-preset.is-active {
  background: #ccfbf1;
  border-color: #5eead4;
  color: #115e59;
  transform: none;
}
.ff-video-lab .vl-trim-row {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.ff-video-lab .vl-trim-row input[type="range"] {
  width: 100%;
  accent-color: #0f766e;
}
.ff-video-lab .vl-ai-banner {
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.92rem;
  margin-bottom: 12px;
}
.ff-video-lab #vlResult video {
  max-width: 100%;
  max-height: min(360px, 40vh);
  border-radius: 12px;
  background: #0f172a;
}
.ff-ad-feed {
  margin: 28px 0 8px;
  min-height: 80px;
  padding: 4px 0 8px;
}
.ff-ad-feed-label,
.ff-ad-rail-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 8px;
}
.seo-content {
  margin-top: 36px;
  padding-top: 8px;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.6;
}
.seo-content h2 {
  font-size: 1.12rem;
  margin: 1.35rem 0 0.55rem;
  color: #1e293b;
}
.seo-content p { margin-bottom: 0.7rem; }
.seo-more {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.seo-more > summary {
  cursor: pointer;
  font-weight: 600;
  color: #4f46e5;
  list-style: none;
}
.seo-more > summary::-webkit-details-marker { display: none; }
.ff-ad-feed--editor {
  margin: 0;
  padding: 28px 24px 48px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

/* Editor reserved strip — under chrome, never over canvas */
.ff-ad-slot-editor {
  flex: 0 0 auto;
  width: 100%;
  min-height: 88px;
  box-sizing: border-box;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), transparent 40%);
}
.ff-ad-slot-editor-inner {
  max-width: 728px;
  margin: 0 auto;
  padding: 12px 16px 14px;
}
.ff-ad-slot-editor .ff-ad-feed-label {
  margin-bottom: 8px;
  opacity: 0.85;
}
.video-editor-body .ff-ad-slot-editor,
.fe-body .ff-ad-slot-editor,
.pdf-editor-body .ff-ad-slot-editor,
.word-editor-body .ff-ad-slot-editor {
  background: #121215;
  border-top-color: #25252b;
}
.video-editor-body .ff-ad-feed-label,
.fe-body .ff-ad-feed-label,
.pdf-editor-body .ff-ad-feed-label,
.word-editor-body .ff-ad-feed-label,
.video-editor-body .ff-ad-slot-editor .ff-ad-feed-label {
  color: #64748b;
}
.video-editor-body .ff-ad-feed--editor {
  background: #121214;
  border-top-color: #2a2a2c;
  color: #cbd5e1;
}
.video-editor-body .ff-ad-feed-label { color: #64748b; }
.fe-body .ff-ad-feed--editor,
.pdf-editor-body .ff-ad-feed--editor,
.word-editor-body .ff-ad-feed--editor {
  background: #121214;
  border-top-color: #2a2a2c;
}
.ff-ad-rail {
  display: none;
}
@media (min-width: 1180px) {
  body.ff-ads-ready.ff-ads-rail:not(.ff-ads-editor) .ff-ad-rail {
    display: block;
    position: fixed;
    top: 24px;
    right: 16px;
    width: 300px;
    max-height: calc(100vh - 40px);
    overflow: auto;
    z-index: 45;
    padding: 0;
    background: transparent;
  }
  body.ff-ads-ready.ff-ads-rail:not(.ff-ads-editor) .ff-ad-rail-inner {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  }
  body.ff-ads-ready.ff-ads-rail:not(.ff-ads-editor) .ff-ad-rail-box {
    min-height: 250px;
    min-width: 240px;
  }
  body.ff-ads-ready.ff-ads-rail:not(.ff-ads-editor) .main-content {
    width: calc(100% - var(--filefy-sb-width, 280px) - 332px);
    max-width: none;
  }
  body.ff-ads-ready.ff-ads-rail:not(.ff-ads-editor) .ff-ad-feed {
    display: none;
  }
}
@media (max-width: 900px) {
  .ff-video-lab .vl-workspace {
    grid-template-columns: 1fr;
  }
  .ff-video-lab .ff-lab-panel {
    position: static;
  }
  .ff-video-lab .vl-preview-stage {
    max-height: min(320px, 42vh);
  }
}
