/* ==========================================================================
   IDOffice Styles (DOCX, PPTX, XLSX)
   Light & Dark Theme Harmonized Floating Window
   ========================================================================== */

/* Badges */
.badge-docx {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.badge-xlsx {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-pptx {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}
.badge-md {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.38);
}

body.theme-light .badge-docx {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
body.theme-light .badge-xlsx {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
body.theme-light .badge-pptx {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}
body.theme-light .badge-md {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #d8b4fe;
}

.office-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  line-height: 1.2;
}

.office-mini-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  min-width: 44px;
  height: 24px;
  padding: 0 7px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Docs 2-Pane Split View (Tandem Bento Island Layout) */
.docs-split-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 128px);
  width: 100%;
  gap: 12px;
  padding: 0 12px 12px;
}

.docs-list-column {
  width: 380px;
  min-width: 300px;
  max-width: 440px;
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 24px);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--column, #1f1b17);
  box-shadow: var(--shadow, 0 12px 32px rgba(24, 18, 13, 0.06));
  flex-shrink: 0;
}

body.theme-light .docs-list-column {
  background: var(--column, #e8e3dc);
  border-color: var(--hair, rgba(28, 22, 17, 0.08));
}

.docs-preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--wash, var(--column));
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  border-radius: var(--r-lg, 24px);
  box-shadow: var(--shadow, 0 12px 32px rgba(24, 18, 13, 0.06));
  position: relative;
}

body.theme-light .docs-preview-pane {
  background: var(--wash, #f4f0eb);
  border-color: var(--hair, rgba(28, 22, 17, 0.08));
}

.docs-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim, #94a3b8);
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.docs-preview-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.docs-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hair, rgba(255, 255, 255, 0.08));
  background: var(--card, rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

body.theme-light .docs-preview-header {
  background: var(--card, rgba(255, 255, 255, 0.78));
  border-bottom-color: var(--hair, rgba(28, 22, 17, 0.08));
}

.docs-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.doc-card.active {
  background: var(--hl, #27221d) !important;
  color: var(--hl-ink, #f7f4ef) !important;
  border-color: var(--accent, #b84a23) !important;
}

body.theme-light .doc-card.active {
  background: var(--hl, #1d1a17) !important;
  color: var(--hl-ink, #f8f5f0) !important;
  border-color: var(--accent, #b84a23) !important;
}

.doc-card.active .doc-card-meta,
body.theme-light .doc-card.active .doc-card-meta {
  color: rgba(248, 245, 240, 0.72) !important;
}

/* Floating Window Container for Office */
.office-float-win {
  min-width: 520px;
  min-height: 420px;
  width: 960px;
  height: 680px;
  max-width: 98vw;
  max-height: calc(100vh - 12px);
  z-index: 105;
}

.office-header-save-btn {
  padding: 4px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin-right: 6px;
}

.office-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg-surface, #1b1713);
}

body.theme-light .office-body {
  background: var(--bg-surface, #f6f3ee);
}

/* Docs Dropdown Creation Menu in Sidebar */
.docs-compose-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}

.docs-compose-btn .docs-compose-caret {
  margin-left: 2px;
  opacity: 0.85;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}

.docs-compose-btn.open .docs-compose-caret {
  transform: rotate(180deg);
}

.docs-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 256px;
  background: var(--card-solid, #201c18) !important;
  border: 1px solid var(--hair-strong, rgba(255, 255, 255, 0.14)) !important;
  border-radius: 18px;
  padding: 7px;
  box-shadow: 0 22px 48px -10px rgba(0, 0, 0, 0.55), 0 6px 16px rgba(0, 0, 0, 0.24) !important;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transform-origin: top left;
}

body.theme-light .docs-dropdown-menu {
  background: var(--card-solid, #ffffff) !important;
  border-color: var(--hair-strong, rgba(28, 22, 17, 0.14)) !important;
  box-shadow: 0 20px 44px -10px rgba(24, 18, 13, 0.22), 0 4px 14px rgba(24, 18, 13, 0.08) !important;
}

.docs-dropdown-menu.hidden {
  display: none !important;
}

.docs-dropdown-divider {
  margin: 4px 6px !important;
  width: calc(100% - 12px) !important;
  height: 1px !important;
  background: var(--hair, rgba(255, 255, 255, 0.1)) !important;
}

body.theme-light .docs-dropdown-divider {
  background: var(--hair, rgba(28, 22, 17, 0.09)) !important;
}

.docs-dropdown-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink, #f4efe8);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.docs-dropdown-item:hover {
  background: var(--sunk, rgba(255, 255, 255, 0.08));
  border-color: var(--hair, rgba(255, 255, 255, 0.08));
  transform: translateX(2px);
}

body.theme-light .docs-dropdown-item:hover {
  background: var(--sunk, rgba(28, 22, 17, 0.055));
  border-color: var(--hair, rgba(28, 22, 17, 0.08));
}

.docs-dropdown-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.docs-dropdown-title {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink, #f1f5f9);
}

body.theme-light .docs-dropdown-title {
  color: var(--ink, #1c1815);
}

.docs-dropdown-sub {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light .docs-dropdown-sub {
  color: var(--muted, #6a6158);
}

/* Office Toolbar */
.office-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.office-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-surface, #1e293b);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
  overflow: visible;
}

body.theme-light .office-toolbar {
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
}

.btn-tb {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main, #f1f5f9);
  padding: 4px 6px;
  min-width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.theme-light .btn-tb {
  color: #334155;
}

.btn-tb:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

body.theme-light .btn-tb:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.btn-tb.active {
  background: rgba(59, 130, 246, 0.25) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  color: #60a5fa !important;
}

body.theme-light .btn-tb.active {
  background: #dbeafe !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
}

.btn-tb-sm {
  min-width: 22px;
  height: 24px;
  padding: 2px 5px;
  font-size: 11px;
}

.btn-tb-text {
  font-weight: 500;
  font-size: 12px;
  padding: 4px 8px;
}

.tb-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color, rgba(255, 255, 255, 0.12));
  margin: 0 4px;
  flex-shrink: 0;
}

body.theme-light .tb-divider {
  background: #cbd5e1;
}

.tb-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-main, #f1f5f9);
  padding: 2px 6px;
  font-size: 12px;
  height: 28px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

body.theme-light .tb-select {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.tb-style-select { width: 110px; }
.tb-font-select { width: 130px; }
.tb-zoom-select { width: 75px; }
.tb-spacing-select { width: 70px; }

.tb-size-stepper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  height: 28px;
  padding: 0 2px;
  flex-shrink: 0;
}

body.theme-light .tb-size-stepper {
  background: #ffffff;
  border-color: #cbd5e1;
}

.tb-size-input {
  width: 32px;
  border: none;
  background: transparent;
  text-align: center;
  color: var(--text-main, #f1f5f9);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

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

body.theme-light .tb-size-input {
  color: #0f172a;
}

/* Ruler Styling */
.docx-ruler-wrapper {
  background: #1e293b;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  display: flex;
  justify-content: center;
  padding: 0 24px;
  flex-shrink: 0;
  user-select: none;
  position: relative;
}

body.theme-light .docx-ruler-wrapper {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.docx-ruler {
  width: 100%;
  max-width: 912px;
  height: 22px;
  background: #ffffff;
  position: relative;
  display: flex;
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.docx-ruler-track {
  width: 100%;
  height: 100%;
  display: flex;
  position: relative;
}

.ruler-unit {
  flex: 1;
  height: 100%;
  border-right: 1px solid #94a3b8;
  position: relative;
  font-size: 9px;
  font-family: Arial, sans-serif;
  color: #475569;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}

.ruler-tick-sub {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 6px;
  background: #cbd5e1;
}

.ruler-marker-first-line {
  position: absolute;
  left: 92px;
  top: 1px;
  width: 14px;
  height: 6px;
  cursor: ew-resize;
  z-index: 12;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ruler-marker-rect {
  width: 14px;
  height: 5px;
  background: #2563eb;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ruler-marker-left {
  position: absolute;
  left: 56px;
  top: 7px;
  width: 14px;
  height: 14px;
  cursor: ew-resize;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ruler-marker-right {
  position: absolute;
  right: 56px;
  top: 7px;
  width: 14px;
  height: 14px;
  cursor: ew-resize;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ruler-marker-triangle {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #2563eb;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}

.docx-ruler-guideline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed #2563eb;
  pointer-events: none;
  z-index: 50;
  display: none;
}

/* Loading & Error States */
.office-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

/* 1. DOCX Paper Styling */
.docx-paper-container {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  position: relative;
}

body.theme-light .docx-paper-container {
  background: #e2e8f0;
}

.docx-paper {
  --docx-indent: 36px;
  --docx-line-height: 1.5;
  width: 100%;
  max-width: 800px;
  min-height: 960px;
  background: #ffffff;
  color: #1a1a1a;
  padding: 48px 56px;
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  outline: none;
  font-family: Arial, sans-serif;
  line-height: var(--docx-line-height, 1.5);
  font-size: 14px;
  transform-origin: top center;
  transition: transform 0.15s ease;
  position: relative;
}

body.theme-light .docx-paper {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.docx-paper p, .docx-paper .docx-paragraph, .docx-paper div {
  line-height: var(--docx-line-height, 1.5);
  margin-bottom: 8px;
}

.docx-paragraph {
  min-height: 22px;
  outline: none;
  text-align: justify;
}

.docx-paper ul, .docx-paper ol {
  margin: 6px 0 10px 0;
  padding-left: 0;
  list-style-position: inside;
}

.docx-paper li {
  margin-bottom: 4px;
  line-height: var(--docx-line-height, 1.5);
  list-style-position: inside;
}

.docx-paper ul ul, .docx-paper ol ol, .docx-paper ul ol, .docx-paper ol ul {
  padding-left: 24px;
  margin: 4px 0;
}

.docx-paragraph:focus, .docx-paper p:focus, .docx-paper li:focus {
  background: rgba(59, 130, 246, 0.04);
}

/* Document Table Styling */
.docx-table-wrap {
  margin: 16px 0;
  position: relative;
  display: block;
}

.docx-table-actions {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  opacity: 0.85;
}

.docx-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  border: 1px solid #94a3b8;
}

.docx-table th, .docx-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  min-width: 60px;
  outline: none;
  font-size: 13px;
}

.docx-table th {
  background: #f1f5f9;
  font-weight: 600;
}

.docx-table td:focus, .docx-table th:focus {
  background: #eff6ff;
  border-color: #3b82f6;
}

/* 2. XLSX Spreadsheet Grid Styling */
.xlsx-toolbar {
  gap: 6px;
  flex-wrap: wrap;
}

.xlsx-cell-pos {
  font-weight: 700;
  font-family: monospace;
  font-size: 13px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  color: #10b981;
  min-width: 44px;
  text-align: center;
}

body.theme-light .xlsx-cell-pos {
  background: #e2e8f0;
  color: #047857;
}

.xlsx-formula-input {
  flex: 1;
  min-width: 160px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 4px 10px;
  color: var(--text-main, #f1f5f9);
  font-size: 13px;
  outline: none;
}

body.theme-light .xlsx-formula-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.xlsx-formula-input:focus {
  border-color: #10b981;
}

.xlsx-grid-container {
  flex: 1;
  overflow: auto;
  background: #0f141c;
}

body.theme-light .xlsx-grid-container {
  background: #f8fafc;
}

.xlsx-table {
  --xl-auto-border: #e2e8f0;
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.xlsx-corner, .xlsx-col-header, .xlsx-row-header {
  background: #1a2230;
  color: var(--text-dim, #94a3b8);
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

body.theme-light .xlsx-corner,
body.theme-light .xlsx-col-header,
body.theme-light .xlsx-row-header {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

.xlsx-col-header {
  min-width: 90px;
  padding: 5px 8px;
}

.xlsx-row-header {
  width: 42px;
  padding: 4px 6px;
}

.xlsx-cell {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  color: var(--text-main, #e2e8f0);
  outline: none;
  min-width: 90px;
  height: 24px;
  white-space: nowrap;
}

body.theme-light .xlsx-cell {
  border-color: #e2e8f0;
  color: #1e293b;
  background: #ffffff;
}

.xlsx-cell:focus {
  outline: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.12);
}

body.theme-light .xlsx-cell:focus {
  background: rgba(16, 185, 129, 0.08);
}

.xlsx-sheet-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #141b27;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

body.theme-light .xlsx-sheet-tabs {
  background: #f1f5f9;
  border-top-color: #e2e8f0;
}

.xlsx-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim, #94a3b8);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

body.theme-light .xlsx-tab {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
}

.xlsx-tab.active {
  background: #10b981;
  color: #ffffff;
  font-weight: 700;
  border-color: #10b981;
}

.xlsx-tab-add {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  color: var(--text-dim, #94a3b8);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

body.theme-light .xlsx-tab-add {
  border-color: #cbd5e1;
  color: #64748b;
}

/* 3. PPTX Slide Deck Styling */
.pptx-stage {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.pptx-sidebar {
  width: 190px;
  background: rgba(0, 0, 0, 0.25);
  border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

body.theme-light .pptx-sidebar {
  background: #f1f5f9;
  border-right-color: #e2e8f0;
}

.pptx-thumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.15s ease;
}

body.theme-light .pptx-thumb {
  background: #ffffff;
  border-color: #cbd5e1;
}

.pptx-thumb.active, .pptx-thumb:hover {
  background: rgba(249, 115, 22, 0.15);
  border-color: #f97316;
}

body.theme-light .pptx-thumb.active {
  background: #fff7ed;
  border-color: #f97316;
}

.pptx-thumb-num {
  font-weight: 700;
  font-size: 12px;
  color: #f97316;
}

.pptx-thumb-preview {
  font-size: 11px;
  color: var(--text-main, #f1f5f9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-light .pptx-thumb-preview {
  color: #334155;
}

.pptx-canvas-wrap {
  flex: 1;
  overflow: auto;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

body.theme-light .pptx-canvas-wrap {
  background: #e2e8f0;
}

.pptx-slide-canvas {
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  padding: 36px 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.theme-light .pptx-slide-canvas {
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
}

.pptx-shape {
  width: 100%;
}

.pptx-textarea {
  width: 100%;
  border: 1px dashed transparent;
  outline: none;
  background: transparent;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  resize: none;
  line-height: 1.5;
  transition: border-color 0.15s ease;
}

.pptx-textarea:focus {
  border-color: #f97316;
  border-radius: 4px;
  background: rgba(249, 115, 22, 0.04);
}

.pptx-title-shape .pptx-textarea {
  font-size: 22px;
  font-weight: 700;
  height: 48px;
}

.pptx-body-shape .pptx-textarea {
  font-size: 14px;
  height: 160px;
}

/* XLSX selection, formatting toolbar */
/* An inset shadow tints the selection on top of any theme or user fill color */
.xlsx-cell.xl-sel,
body.theme-light .xlsx-cell.xl-sel {
  box-shadow: inset 0 0 0 1000px rgba(59, 130, 246, 0.28);
}
body.theme-light .xlsx-cell.xl-sel {
  box-shadow: inset 0 0 0 1000px rgba(37, 99, 235, 0.22);
}
.xlsx-grid-container.xl-dragging,
.xlsx-grid-container.xl-dragging * {
  user-select: none;
  cursor: cell;
}
.xlsx-col-header.xl-hl,
.xlsx-row-header.xl-hl {
  background: rgba(16, 185, 129, 0.25);
}
.xlsx-corner,
.xlsx-col-header,
.xlsx-row-header {
  cursor: pointer;
  user-select: none;
}
.xlsx-toolbar .btn-tb.active {
  background: rgba(16, 185, 129, 0.28);
  color: #10b981;
}
.xl-color {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.xl-color input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.xl-numfmt {
  width: 150px;
  min-width: 0;
  flex: 0 0 auto;
  height: 28px;
  margin: 0;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
}
body.theme-light .xl-numfmt,
body.theme-light .xl-color {
  background: #fff;
  border-color: #cbd5e1;
}

.xlsx-cell.xl-merged { vertical-align: middle; }

body.theme-light .xlsx-table {
  --xl-auto-border: #1e293b;
}
.xl-bsel {
  width: 120px;
}

.xl-border-menu {
  position: fixed;
  z-index: 100000;
  width: 180px;
  padding: 4px;
  background: var(--bg-surface, #1e293b);
  color: var(--text-main, #e2e8f0);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.xl-border-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.xl-border-item:hover {
  background: rgba(16, 185, 129, 0.2);
}
body.theme-light .xl-border-menu {
  background: #ffffff;
  color: #1e293b;
  border-color: #cbd5e1;
}

.xl-font { width: 130px; flex: 0 0 auto; height: 28px; }
.xl-func { width: 110px; flex: 0 0 auto; height: 28px; }
.xlsx-toolbar input.xl-size {
  width: 52px;
  min-width: 0;
  margin: 0;
  flex: 0 0 auto;
  height: 28px;
  padding: 0 4px;
  text-align: center;
}

.xl-zoom, .xl-rot { width: 120px; flex: 0 0 auto; height: 28px; }
.xl-zoom { width: 84px; }
.xlsx-cell.xl-comment { position: relative; }
.xlsx-cell.xl-comment::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-top: 7px solid #ef4444;
  border-left: 7px solid transparent;
  pointer-events: none;
}

.doc-comments { margin-top: 20px; border-top: 1px solid var(--border-color, rgba(255,255,255,0.1)); padding-top: 12px; }
.doc-comments-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); margin-bottom: 10px; }
.doc-comment-form textarea { width: 100%; resize: vertical; margin-top: 6px; }
.doc-comment-target { font-size: 12px; color: var(--text-dim); }
.doc-comment-actions { display: flex; gap: 8px; justify-content: flex-end; margin: 8px 0 14px; }
.doc-comment { border: 1px solid var(--border-color, rgba(255,255,255,0.1)); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.doc-comment.resolved { opacity: .55; }
.doc-comment blockquote { margin: 0 0 6px; padding: 2px 8px; border-left: 3px solid #f59e0b; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.doc-comment-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.doc-comment-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.doc-comment-meta a { margin-left: 8px; color: var(--accent, #10b981); }

.pptx-tb-label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-dim); }
.pptx-tb-input { font-size: 12px; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--border, #ccc); background: transparent; color: inherit; max-width: 130px; }
select.pptx-tb-input option { color: #111; }
input[type="color"].pptx-tb-input { width: 30px; height: 24px; padding: 0; cursor: pointer; }
.pptx-slide-canvas.pptx-anim-run { animation-duration: .7s; animation-fill-mode: both; }
.pptx-anim-run.pptx-anim-fade, .pptx-anim-run.pptx-anim-dissolve, .pptx-anim-run.pptx-anim-circle, .pptx-anim-run.pptx-anim-diamond, .pptx-anim-run.pptx-anim-randomBar, .pptx-anim-run.pptx-anim-pull { animation-name: pptxFade; }
.pptx-anim-run.pptx-anim-push, .pptx-anim-run.pptx-anim-cover { animation-name: pptxPush; }
.pptx-anim-run.pptx-anim-wipe, .pptx-anim-run.pptx-anim-split { animation-name: pptxWipe; }
.pptx-anim-run.pptx-anim-zoom { animation-name: pptxZoom; }
@keyframes pptxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pptxPush { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pptxWipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@keyframes pptxZoom { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }

.pptx-show { position: fixed; inset: 0; z-index: 100000; background: #000; cursor: pointer; }
.pptx-show-viewport { position: absolute; inset: 0; overflow: hidden; }
.pptx-show-scale { position: absolute; left: 50%; top: 50%; width: 720px; height: 405px; transform-origin: center; overflow: hidden; }
.pptx-show-stage { position: relative; width: 100%; height: 100%; padding: 36px 44px; box-sizing: border-box; display: flex; flex-direction: column; gap: 18px; overflow: hidden; color: #111; animation-fill-mode: both; animation-duration: .7s; }
.pptx-show-text { width: 100%; white-space: pre-wrap; word-break: break-word; }
.pptx-show-text.is-title { font-size: 22px; font-weight: 700; }
.pptx-show-text.is-body { font-size: 14px; }
.pptx-show-bar { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 10px; align-items: center; color: #fff; font-size: 12px; opacity: 0; transition: opacity .2s; }
.pptx-show:hover .pptx-show-bar { opacity: .85; }
.pptx-show-bar button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 4px; padding: 3px 8px; cursor: pointer; }

.pptx-slide-canvas { position: relative; }
.pptx-img { position: absolute; z-index: 5; cursor: move; box-sizing: border-box; outline: 1px solid transparent; }
.pptx-img img { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; user-select: none; }
.pptx-img.selected { outline: 2px solid #f97316; }
.pptx-img-missing { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(148,163,184,.3); color: #475569; font-size: 11px; overflow: hidden; }
.pptx-img-handle { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #f97316; border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; }
.pptx-show-img { position: absolute; object-fit: fill; }

.pptx-item { position: absolute; z-index: 5; box-sizing: border-box; }
.pptx-item.selected { outline: 2px solid #f97316; }
.pptx-item:not(.selected) .pptx-img-handle, .pptx-item:not(.selected) .pptx-grip { display: none; }
.pptx-obj-shape { cursor: move; }
.pptx-obj-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pptx-obj-text { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 4px 8px; overflow: hidden; word-break: break-word; pointer-events: none; }
.pptx-obj-text.is-box { justify-content: flex-start; }
.pptx-obj-ta { width: 100%; height: 100%; resize: none; border: 1px dashed rgba(148,163,184,.7); outline: none; padding: 4px 8px; box-sizing: border-box; font-family: inherit; line-height: 1.3; overflow: hidden; }
.pptx-grip { position: absolute; left: -2px; top: -20px; background: #f97316; color: #fff; font-size: 12px; line-height: 18px; padding: 0 6px; border-radius: 4px 4px 0 0; cursor: move; user-select: none; }
.pptx-tbl { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; color: #111827; font-size: 11px; }
.pptx-tbl td { border: 1px solid #808080; padding: 0; vertical-align: top; }
.pptx-tbl td.is-head { background: #D9E2F3; font-weight: 700; }
.pptx-tbl input { width: 100%; height: 100%; border: 0; background: transparent; font: inherit; color: inherit; padding: 2px 4px; box-sizing: border-box; outline: none; }
.pptx-tbl input:focus { background: rgba(249,115,22,.1); }
.pptx-show-obj { position: absolute; box-sizing: border-box; }
.pptx-show-obj .pptx-tbl td { padding: 2px 4px; }
.pptx-icons-pop { position: absolute; z-index: 50; top: 30px; left: 0; width: 260px; padding: 8px; background: #fff; color: #111827; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.pptx-icons-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 8px; }
.pptx-icons-grid button { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px; cursor: pointer; color: #1f2937; }
.pptx-icons-grid button:hover { background: #fff1e6; border-color: #f97316; }
.pptx-propbar { border-top: 1px solid rgba(148,163,184,.3); }

/* Popovers (mounted on body) */
.pptx-pop { position: fixed; z-index: 100000; padding: 10px; background: #fff; color: #111827; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; }
.pptx-pop-title { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.pptx-pop-hint { font-size: 11px; color: #64748b; margin-top: 8px; }
.pptx-tg-grid { display: grid; grid-template-columns: repeat(10, 20px); gap: 3px; }
.pptx-tg-cell { width: 20px; height: 20px; border: 1px solid #94a3b8; background: #fff; border-radius: 2px; cursor: pointer; }
.pptx-tg-cell.on { background: #fdba74; border-color: #f97316; }
.pptx-shape-grid { display: grid; grid-template-columns: repeat(6, 64px); gap: 4px; }
.pptx-shape-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 4px; cursor: pointer; font-size: 10px; color: #334155; }
.pptx-shape-grid button:hover { background: #fff1e6; border-color: #f97316; }
.pptx-shape-prev { width: 40px; height: 32px; display: block; overflow: visible; }
.pptx-pop .pptx-icons-grid { grid-template-columns: repeat(6, 38px); margin-top: 4px; }
.pptx-anim-grid { display: grid; grid-template-columns: repeat(3, 92px); gap: 6px; }
.pptx-anim-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; font-size: 11px; color: #334155; }
.pptx-anim-grid button:hover, .pptx-anim-grid button.active { border-color: #f97316; background: #fff1e6; }
.pptx-anim-demo { position: relative; width: 70px; height: 34px; overflow: hidden; background: #e2e8f0; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.pptx-anim-box { display: block; width: 28px; height: 16px; background: #f97316; border-radius: 3px; }
.pptx-anim-grid button:hover .pptx-anim-box { animation-duration: 1s; animation-iteration-count: infinite; }
.pptx-anim-grid button:hover .pptx-a-appear { animation-name: pptx-k-appear; }
.pptx-anim-grid button:hover .pptx-a-fade { animation-name: pptx-k-fade; }
.pptx-anim-grid button:hover .pptx-a-fly { animation-name: pptx-k-fly; }
.pptx-anim-grid button:hover .pptx-a-wipe { animation-name: pptx-k-wipe; }
.pptx-anim-grid button:hover .pptx-a-zoom { animation-name: pptx-k-zoom; }

/* Entrance animations */
.pptx-a-play { animation-duration: .7s; animation-fill-mode: both; animation-timing-function: ease-out; }
.pptx-a-appear.pptx-a-play { animation-name: pptx-k-appear; animation-duration: .01s; }
.pptx-a-fade.pptx-a-play { animation-name: pptx-k-fade; }
.pptx-a-fly.pptx-a-play { animation-name: pptx-k-fly; }
.pptx-a-wipe.pptx-a-play { animation-name: pptx-k-wipe; }
.pptx-a-zoom.pptx-a-play { animation-name: pptx-k-zoom; }
.pptx-pending { visibility: hidden; }
@keyframes pptx-k-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes pptx-k-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pptx-k-fly { from { transform: translateX(-120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pptx-k-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pptx-k-zoom { from { transform: scale(.1); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.docx-paper img { max-width: 100%; height: auto; vertical-align: bottom; }
.docx-paper .docx-img-missing { display: inline-block; padding: 2px 8px; border: 1px dashed #94a3b8; color: #64748b; font-size: 12px; }
.docx-paper a[href] { color: #0563c1; }

.docx-table-actions { flex-wrap: wrap; }
.docx-table[data-props] { table-layout: fixed; }
.docx-table.docx-noborder, .docx-table.docx-noborder td { border-color: transparent; border-style: dashed; }
.docx-table[data-header="1"] tr:first-child td { font-weight: 600; }
.docx-table td[data-vmerge="continue"] { border-top-style: dotted; }
.docx-table-actions .btn-tb { color: #334155; background: #f1f5f9; border: 1px solid #cbd5e1; opacity: 1; }

.docx-ins { color: #0a7d32; text-decoration: underline; background: rgba(10,125,50,.08); }
.docx-del { color: #b3261e; text-decoration: line-through; background: rgba(179,38,30,.08); }
.docx-cmt { background: rgba(255,210,60,.45); cursor: help; }
[data-ro] { cursor: default; }
td[data-review] { box-shadow: inset 0 0 0 1px rgba(255,210,60,.9); }
.docx-review { margin: 8px auto; max-width: 820px; padding: 6px 10px; border: 1px solid #e0c040; background: #fffbe6; color: #333; border-radius: 6px; font-size: 13px; }
.docx-review summary { cursor: pointer; font-weight: 600; }
.docx-review-item { padding: 4px 0; border-top: 1px solid #eee; }
.docx-review-item p { margin: 2px 0; white-space: pre-wrap; }
.docx-review-item span { color: #777; font-size: 12px; }

.docx-page-col { display: flex; flex-direction: column; width: 100%; max-width: 912px; }
.docx-hf { background: #fff; color: #555; padding: 18px 56px 8px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; outline: none; border-radius: 2px 2px 0 0; box-shadow: 0 -4px 14px rgba(0,0,0,.25); position: relative; }
.docx-hf.docx-footer { padding: 8px 56px 18px; border-radius: 0 0 2px 2px; box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.docx-hf.docx-header { border-bottom: 1px dashed #cbd5e1; }
.docx-hf.docx-footer { border-top: 1px dashed #cbd5e1; }
.docx-hf:hover, .docx-hf:focus { background: #f8fafc; }
.docx-hf-ro { opacity: .8; cursor: default; }
.docx-hf > div { margin: 0; min-height: 16px; }
.docx-page-col > .docx-paper { box-shadow: none; border-radius: 0; }

.docx-paper sup.docx-fn { color: #2563eb; cursor: help; font-weight: 600; user-select: none; }

.docx-page-col { position: relative; }
.docx-pageguides { position: absolute; inset: 0; pointer-events: none; }
.docx-pgline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed #94a3b8; }
.docx-pglabel { position: absolute; right: 10px; font-size: 11px; color: #64748b; background: rgba(255,255,255,.85); padding: 0 6px; border-radius: 3px; }
.docx-noguides .docx-pageguides { display: none; }
.docx-page-col { align-self: flex-start; }
.docx-page-col > * { flex-shrink: 0; }

.docx-layout-dlg { background: #fff; color: #1f2937; border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 14px; margin: 8px auto; max-width: 640px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.docx-layout-dlg h4 { margin: 6px 0; font-size: 13px; }
.docx-layout-dlg .dl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.docx-layout-dlg label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #475569; }
.docx-layout-dlg input, .docx-layout-dlg select { padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 4px; color: #111; background: #fff; }
.docx-layout-dlg .dl-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.docx-layout-dlg .btn-tb { color: #1f2937; border: 1px solid #cbd5e1; }
