/* Infinity Office - Word Processor Stylesheet */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-app: #f1f3f5;
  --bg-surface: #ffffff;
  --bg-toolbar: #f8fafc;
  --border-color: #e2e8f0;
  --border-darker: #cbd5e1;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --page-width: 816px; /* standard 8.5in at 96dpi */
  --page-min-height: 1056px; /* standard 11in */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: #1e293b;
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-toolbar: #1e293b;
  --border-color: #334155;
  --border-darker: #475569;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
  height: 48px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* App Switcher */
.app-switcher-wrapper {
  position: relative;
}

.app-switcher-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.app-switcher-btn:hover {
  background-color: var(--bg-toolbar);
  color: var(--text-main);
  border-color: var(--border-color);
}

.app-switcher-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 200;
}

.app-switcher-wrapper.open .app-switcher-dropdown {
  display: block;
}

.app-switcher-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 8px 8px;
}

.app-suite-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-main);
  transition: background-color 0.15s ease;
}

.app-suite-item:hover {
  background-color: var(--bg-toolbar);
}

.app-suite-item.active {
  background-color: var(--primary-light);
}

.app-suite-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #ffffff;
  flex-shrink: 0;
}

.app-suite-icon img,
.logo-icon img,
.app-header img {
  pointer-events: none;
}

.app-suite-icon.home-icon {
  background: linear-gradient(135deg, #385aeb, #8c5ae1, #dc4e41);
}

.app-suite-icon.doc-icon {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.app-suite-icon.sheet-icon {
  background: linear-gradient(135deg, #107c41, #059669);
}

.app-suite-icon.slide-icon {
  background: linear-gradient(135deg, #c2410c, #ea580c);
}

.app-suite-icon.notes-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.app-suite-icon.base-icon {
  background: linear-gradient(135deg, #b43635, #8a1f20);
}
.app-suite-icon.pdf-icon {
  background: linear-gradient(135deg, #e11d48, #be123c);
}



.app-suite-info {
  display: flex;
  flex-direction: column;
}

.app-suite-name {
  font-size: 0.86rem;
  font-weight: 600;
}

.app-suite-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.suite-pills {
  display: inline-flex;
  background-color: var(--bg-app);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.suite-pill {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.suite-pill:hover {
  color: var(--text-main);
}

.suite-pill.active {
  background-color: var(--bg-surface);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.suite-pill.slide-pill.active {
  color: #ea580c;
}

.suite-pill.notes-pill.active {
  color: #d97706;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-icon {
  font-size: 1.3rem;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-title-input {
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
  transition: all 0.2s ease;
  width: 220px;
}

.doc-title-input:hover {
  background: var(--bg-toolbar);
  border-color: var(--border-color);
}

.doc-title-input:focus {
  background: var(--bg-surface);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.status-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.stat-pill {
  font-size: 0.75rem;
  background-color: var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

/* ==========================================================================
   Menu Bar
   ========================================================================== */
.menu-bar {
  height: 28px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 2px;
  font-size: 0.82rem;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

.menu-item {
  position: relative;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-main);
  font-weight: 500;
}

.menu-item:hover, .menu-item.active {
  background-color: var(--border-color);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 6px 0;
  z-index: 100;
}

.menu-item.active > .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  gap: 10px;
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
}

.dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.dropdown-item:hover i {
  color: var(--primary-color);
}

.dropdown-item .shortcut,
.dropdown-item .menu-shortcut {
  margin-left: auto;
  padding-left: 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

html[dir="rtl"] .dropdown-item .shortcut,
html[dir="rtl"] .dropdown-item .menu-shortcut {
  margin-left: 0;
  margin-right: auto;
  padding-left: 0;
  padding-right: 16px;
}

html[dir="rtl"] .dropdown-item .submenu-arrow {
  margin-left: 0;
  margin-right: auto;
  padding-left: 0;
  padding-right: 12px;
  transform: scaleX(-1);
}

html[data-platform="mac"] .shortcut[data-mac],
html[data-platform="mac"] .menu-shortcut[data-mac] {
  font-size: 0 !important;
}
html[data-platform="mac"] .shortcut[data-mac]::before,
html[data-platform="mac"] .menu-shortcut[data-mac]::before {
  content: attr(data-mac);
  font-size: 0.72rem !important;
  color: var(--text-muted);
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
html[data-platform="windows"] .shortcut[data-win],
html[data-platform="windows"] .menu-shortcut[data-win] {
  font-size: 0 !important;
}
html[data-platform="windows"] .shortcut[data-win]::before,
html[data-platform="windows"] .menu-shortcut[data-win]::before {
  content: attr(data-win);
  font-size: 0.72rem !important;
  color: var(--text-muted);
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.dropdown-item .submenu-arrow {
  margin-left: auto;
  padding-left: 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dropdown-menu hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 5px 0;
}

/* Submenu & Table Grid Flyout (Google Docs Style) */
.dropdown-submenu-item {
  position: relative;
}

.dropdown-submenu-item:hover > .table-grid-flyout,
.dropdown-submenu-item:hover > .submenu-flyout {
  display: block !important;
}

.submenu-flyout {
  display: none;
  top: -6px;
  left: 100%;
  min-width: 230px;
}

/* Google Chrome Style Zoom Row in Menus */
.menu-zoom-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  cursor: default;
  user-select: none;
}

.menu-zoom-row:hover {
  background: none !important;
  color: inherit !important;
}

.menu-zoom-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-color);
  font-weight: 500;
}

.menu-zoom-left i {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.menu-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.menu-zoom-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  padding: 0;
}

.menu-zoom-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.menu-zoom-btn:active {
  transform: scale(0.92);
}

.menu-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.menu-zoom-label:hover {
  background: var(--bg-hover);
}

.menu-zoom-fullscreen {
  margin-left: 4px;
  border-radius: 4px !important;
}

/* 2x2 Page Numbers Visual Picker Flyout */
.page-numbers-flyout {
  min-width: 176px;
  padding: 10px 0 6px 0;
}

.page-numbers-grid {
  display: grid;
  grid-template-columns: repeat(2, 68px);
  gap: 8px;
  padding: 0 14px 10px 14px;
  justify-content: center;
}

.page-num-card {
  width: 68px;
  height: 68px;
  background-color: var(--bg-surface);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s ease;
}

.page-num-card:hover {
  border-color: #1a73e8;
  background-color: var(--primary-light);
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.15);
}

/* Document Header & Footer Blocks */
.doc-header-block {
  border-bottom: 1.5px dashed #cbd5e1;
  padding: 6px 10px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: text;
}

.doc-header-block:hover {
  background-color: rgba(241, 245, 249, 0.6);
  border-bottom-color: var(--primary-color, #1a73e8);
}

.doc-footer-block {
  border-top: 1.5px dashed #cbd5e1;
  padding: 6px 10px;
  margin-top: 24px;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: text;
}

.doc-footer-block:hover {
  background-color: rgba(241, 245, 249, 0.6);
  border-top-color: var(--primary-color, #1a73e8);
}

.doc-hf-content {
  flex: 1;
  outline: none;
  min-height: 1.2em;
}

.doc-hf-close {
  opacity: 0;
  cursor: pointer;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
  user-select: none;
}

.doc-header-block:hover .doc-hf-close,
.doc-footer-block:hover .doc-hf-close {
  opacity: 1;
}

.doc-hf-close:hover {
  background-color: #fee2e2;
  color: #ef4444;
}

.doc-page-break {
  border-top: 2px dashed #94a3b8;
  margin: 28px 0;
  position: relative;
  text-align: center;
  page-break-after: always;
}

/* Per-Page Visual Header & Footer Overlays (multi-page document mode) */
.doc-page-overlay {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: #64748b;
  pointer-events: none;
  user-select: none;
  z-index: 5;
  border-radius: 4px;
}

.doc-page-header-overlay {
  border-bottom: 1.5px dashed #cbd5e1;
}

.doc-page-footer-overlay {
  border-top: 1.5px dashed #cbd5e1;
}

.doc-page-overlay .doc-hf-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-page-overlay .doc-hf-pagenum {
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="dark"] .doc-page-header-overlay,
[data-theme="dark"] .doc-page-footer-overlay {
  border-color: #334155;
  color: #94a3b8;
}

.doc-page-break span {
  position: relative;
  top: -10px;
  background: var(--bg-surface);
  padding: 2px 10px;
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}

.doc-toc-block {
  border: 1px solid var(--border-color);
  background-color: rgba(241, 245, 249, 0.5);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 14px 0;
}

[data-theme="dark"] .doc-toc-block {
  background-color: rgba(30, 41, 59, 0.6);
}

.doc-watermark-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 4.2rem;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.18);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
  letter-spacing: 0.12em;
}

/* Symbols Modal Styling */
.symbols-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.symbols-search-row input {
  width: 100%;
}

.symbols-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-toolbar);
}

.symbol-btn {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

.symbol-btn:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  transform: scale(1.08);
}

.symbol-btn.active {
  border-color: var(--primary-color);
  outline: 2px solid var(--primary-color);
}

.symbol-preview-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-surface);
}

.symbol-preview-char {
  font-size: 2rem;
  min-width: 44px;
  text-align: center;
}

.symbol-preview-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.symbol-preview-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.symbol-preview-code {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-grid-flyout {
  display: none;
  position: absolute;
  top: -6px;
  left: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 10px;
  z-index: 120;
  width: 216px;
}

.toolbar-dropdown-container {
  position: relative;
}

.toolbar-grid-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  z-index: 1050;
}

.table-grid-header {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  user-select: none;
}

.table-grid-header:hover {
  background-color: var(--bg-hover, rgba(0, 0, 0, 0.05));
  color: var(--primary-color, #2563eb);
}

.table-grid-header i {
  color: var(--text-muted);
}

.table-grid-picker {
  display: grid;
  grid-template-columns: repeat(10, 16px);
  grid-template-rows: repeat(10, 16px);
  gap: 3px;
  padding: 4px 0;
}

.grid-cell {
  width: 16px;
  height: 16px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.08s ease, border-color 0.08s ease;
}

[data-theme="dark"] .grid-cell {
  border-color: #475569;
  background-color: #1e293b;
}

.grid-cell.highlighted {
  background-color: #bfdbfe !important;
  border-color: #3b82f6 !important;
}

.table-grid-footer {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}


/* ==========================================================================
   Toolbar / Ribbon
   ========================================================================== */
.toolbar-container {
  min-height: 42px;
  background-color: var(--bg-toolbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 20;
}

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

.toolbar-divider {
  width: 1px;
  height: 20px;
  background-color: var(--border-darker);
  margin: 0 4px;
}

.tool-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
  border-color: var(--border-color);
}

[data-theme="dark"] .tool-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.tool-btn.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-color: rgba(37, 99, 235, 0.3);
}

/* Toolbar Split Button for Bullets & Numbering */
.toolbar-split-btn {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  vertical-align: middle;
  background-color: transparent;
  height: 30px;
}

.toolbar-split-btn .tool-btn {
  border-radius: 0;
  margin: 0;
  height: 30px;
}

.toolbar-split-btn .tool-btn:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  width: 26px;
  min-width: 26px;
  padding: 0;
}

.toolbar-split-btn .tool-btn.split-arrow-btn {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  width: 14px;
  min-width: 14px;
  padding: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toolbar-split-btn:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.toolbar-split-btn .tool-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

.toolbar-split-btn .tool-btn.active,
.toolbar-split-btn .tool-btn.split-arrow-btn.active {
  background-color: var(--primary-light, rgba(37, 99, 235, 0.12));
  color: var(--primary-color, #2563eb);
}

[data-theme="dark"] .toolbar-split-btn .tool-btn.split-arrow-btn {
  border-left-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .toolbar-split-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .toolbar-split-btn .tool-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.micro-caret {
  font-size: 0.6rem;
  color: var(--text-muted);
  pointer-events: none;
}

.tool-select,
.tool-input {
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 0 6px;
  outline: none;
  cursor: pointer;
}

.tool-input {
  cursor: text;
  text-align: center;
  box-sizing: border-box;
}

.tool-select:focus,
.tool-input:focus {
  border-color: var(--primary-color);
}

.font-select {
  width: 140px;
}

.size-select,
.size-input {
  width: 58px;
}

.heading-select {
  width: 110px;
}

.tool-color-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 0.78rem;
  color: var(--text-main);
}

.tool-color-btn input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.tool-color-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

.color-bar {
  width: 14px;
  height: 3px;
  border-radius: 1px;
  margin-top: 1px;
}

/* ==========================================================================
   Find & Replace Bar
   ========================================================================== */
.find-replace-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  z-index: 30;
  gap: 12px;
}

.find-inputs {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 600px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.input-with-icon i {
  position: absolute;
  left: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.input-with-icon input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 28px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.85rem;
  background-color: var(--bg-surface);
  color: var(--text-main);
  outline: none;
}

.find-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 45px;
}

.btn-icon-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 4px 6px;
}

/* ==========================================================================
   Workspace & Document Editor
   ========================================================================== */
.workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ruler-top-row {
  display: flex;
  flex-direction: row;
  height: 22px;
  background-color: #f8fafd;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  position: relative;
  z-index: 15;
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

[data-theme="dark"] .ruler-top-row {
  background-color: #1e2430;
}

.ruler-corner {
  width: 22px;
  height: 22px;
  background-color: #f1f3f6;
  border-right: 1px solid var(--border-color);
  flex-shrink: 0;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .ruler-corner {
  background-color: #1a202c;
}

.ruler-container {
  flex: 1;
  height: 22px;
  overflow: hidden;
  user-select: none;
  position: relative;
}

[data-theme="dark"] .ruler-container {
  background-color: #1e2430;
}

.workspace-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
}

.ruler-vertical-container {
  width: 22px;
  background-color: #f8fafd;
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  user-select: none;
  position: relative;
  flex-shrink: 0;
  z-index: 14;
}

[data-theme="dark"] .ruler-vertical-container {
  background-color: #1e2430;
}

.ruler-vertical {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
  background-color: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .ruler-vertical {
  background-color: #2b3240;
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.ruler-margin-top,
.ruler-margin-bottom {
  position: absolute;
  left: 0;
  right: 0;
  background-color: #ebedf0;
  z-index: 1;
}

[data-theme="dark"] .ruler-margin-top,
[data-theme="dark"] .ruler-margin-bottom {
  background-color: #1f2533;
}

.ruler-margin-top {
  top: 0;
  border-bottom: 1px solid #cbd5e1;
}

.ruler-margin-bottom {
  bottom: 0;
  border-top: 1px solid #cbd5e1;
}

.ruler-vertical-scale {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.ruler-tick-vertical {
  position: absolute;
  right: 0;
  height: 1px;
  background-color: #94a3b8;
}

.ruler-tick-vertical.tick-major {
  width: 9px;
  background-color: #64748b;
}

.ruler-tick-vertical.tick-half {
  width: 6px;
  background-color: #94a3b8;
}

.ruler-tick-vertical.tick-quarter {
  width: 4px;
  background-color: #cbd5e1;
}

.ruler-number-vertical {
  position: absolute;
  right: 11px;
  font-size: 9px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  color: #475569;
  transform: translateY(-50%);
  user-select: none;
}

[data-theme="dark"] .ruler-number-vertical {
  color: #94a3b8;
}

/* Vertical Margin Markers */
.ruler-vertical-marker-assembly {
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  transform: translateY(-50%);
  cursor: ns-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 1px;
}

.ruler-vertical-triangle {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid #1a73e8;
  cursor: ns-resize;
  transition: transform 0.1s ease;
}

.ruler-vertical-triangle:hover,
.ruler-vertical-marker-assembly.active .ruler-vertical-triangle {
  border-left-color: #1557b0;
  transform: scale(1.15);
}

.ruler-guide-line-horizontal {
  position: fixed;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed #1a73e8;
  pointer-events: none;
  z-index: 999;
  display: none;
}

.ruler {
  width: var(--page-width);
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  background-color: #ffffff;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
  border-right: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .ruler {
  background-color: #2b3240;
  border-left-color: rgba(255, 255, 255, 0.12);
  border-right-color: rgba(255, 255, 255, 0.12);
}

/* Margin Shade Overlays (grayed out non-printable margin areas) */
.ruler-margin-left,
.ruler-margin-right {
  position: absolute;
  top: 0;
  bottom: 0;
  background-color: #ebedf0;
  z-index: 1;
}

[data-theme="dark"] .ruler-margin-left,
[data-theme="dark"] .ruler-margin-right {
  background-color: #1f2533;
}

.ruler-margin-left {
  left: 0;
  border-right: 1px solid #cbd5e1;
}

.ruler-margin-right {
  right: 0;
  border-left: 1px solid #cbd5e1;
}

/* Ruler numbers and tick marks canvas/wrapper */
.ruler-scale {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.ruler-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  background-color: #94a3b8;
}

.ruler-tick.tick-major {
  height: 9px;
  background-color: #64748b;
}

.ruler-tick.tick-half {
  height: 6px;
  background-color: #94a3b8;
}

.ruler-tick.tick-quarter {
  height: 4px;
  background-color: #cbd5e1;
}

.ruler-number {
  position: absolute;
  top: 1px;
  font-size: 9px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  color: #475569;
  transform: translateX(-50%);
  user-select: none;
}

[data-theme="dark"] .ruler-number {
  color: #94a3b8;
}

/* Google Docs Blue Markers */
/* Left Indent Marker assembly (First-line bar + Left Indent triangle) */
.ruler-marker-assembly {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* First-Line Indent: horizontal rectangle bar at top */
.ruler-firstline-marker {
  width: 12px;
  height: 4px;
  background-color: #1a73e8;
  border-radius: 1px;
  cursor: ew-resize;
  transition: transform 0.1s ease;
  margin-top: 1px;
}

.ruler-firstline-marker:hover,
.ruler-firstline-marker.active {
  background-color: #1557b0;
  transform: scaleY(1.3);
}

/* Downward pointing triangle (Left Indent / Right Indent) */
.ruler-indent-triangle {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #1a73e8;
  cursor: ew-resize;
  transition: transform 0.1s ease;
  margin-bottom: 0px;
}

.ruler-indent-triangle:hover,
.ruler-indent-triangle.active {
  border-top-color: #1557b0;
  transform: scale(1.15);
}

/* Right Indent Marker assembly */
.ruler-right-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.ruler-right-marker .ruler-indent-triangle {
  margin-bottom: 0px;
}

/* Guide Line through the document while dragging */
.ruler-guide-line {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed #1a73e8;
  pointer-events: none;
  z-index: 999;
  display: none;
}

.document-scroller {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 30px 20px 180px 20px;
  display: flex;
  justify-content: center;
  background-color: var(--bg-app);
}

.page-container {
  transform-origin: top center;
  transition: transform 0.15s ease-out;
  position: relative;
}

.document-page {
  width: var(--page-width);
  min-height: var(--page-min-height);
  background-color: #ffffff;
  color: #1a1a1a;
  padding: 72px 72px; /* Standard 1-inch margins */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  outline: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11pt;
  line-height: 1.6;
  user-select: text;
  word-wrap: break-word;
  position: relative;
}

[data-theme="dark"] .document-page {
  background-color: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Automatic Interactive Page Break Dividers (Google Docs Visual Multi-Page Layout) */
.auto-page-break-divider {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1.5px dashed #94a3b8;
  pointer-events: none;
  user-select: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.auto-page-break-divider .page-num-badge {
  position: absolute;
  right: 18px;
  top: -11px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 12px;
  padding: 1px 9px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .auto-page-break-divider {
  border-top-color: #475569;
}

[data-theme="dark"] .auto-page-break-divider .page-num-badge {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.auto-page-break-gap,
.auto-page-break-margin-bottom,
.auto-page-break-margin-top {
  display: none !important;
  height: 0 !important;
}

@media print {
  .auto-page-break-divider {
    display: none !important;
  }
}

/* Empty page placeholder */
.document-page:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
  position: absolute;
}

/* Document content elements formatting */
.document-page h1 {
  font-size: 26pt;
  font-weight: 700;
  margin-top: 1.2em;
  margin-bottom: 0.4em;
  line-height: 1.2;
}

.document-page h2 {
  font-size: 19pt;
  font-weight: 600;
  margin-top: 1.1em;
  margin-bottom: 0.35em;
  line-height: 1.25;
}

.document-page h3 {
  font-size: 14pt;
  font-weight: 600;
  margin-top: 1em;
  margin-bottom: 0.3em;
}

.document-page p {
  margin-bottom: 0.8em;
}

.document-page blockquote {
  border-left: 4px solid var(--primary-color);
  padding: 6px 16px;
  margin: 1em 0;
  color: #475569;
  font-style: italic;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}

[data-theme="dark"] .document-page blockquote {
  background: #0f172a;
  color: #cbd5e1;
}

.document-page pre {
  background-color: #1e293b;
  color: #f8fafc;
  padding: 12px 16px;
  border-radius: 6px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 9.5pt;
  overflow-x: auto;
  margin: 1em 0;
}

[data-theme="dark"] .document-page pre {
  background-color: #0f172a;
  border: 1px solid #334155;
}

.document-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.document-page table th, 
.document-page table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  text-align: left;
}

[data-theme="dark"] .document-page table th,
[data-theme="dark"] .document-page table td {
  border-color: #475569;
}

.document-page table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

[data-theme="dark"] .document-page table th {
  background-color: #334155;
  color: #f8fafc;
}

.document-page img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 8px 0;
}

.document-page a {
  color: var(--primary-color);
  text-decoration: underline;
}

.document-page .callout-box {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  padding: 12px 16px;
  border-radius: 4px;
  margin: 12px 0;
  display: flex;
  gap: 12px;
}

[data-theme="dark"] .document-page .callout-box {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  border-left: 4px solid #3b82f6;
  color: #e2e8f0;
}

.document-page .callout-icon {
  color: #2563eb;
  font-size: 1.2rem;
  margin-top: 2px;
}

.document-page .todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

/* Match search highlights */
.search-highlight {
  background-color: #fef08a !important;
  color: #000000 !important;
  border-radius: 2px;
}

.search-highlight.active {
  background-color: #f97316 !important;
  color: #ffffff !important;
}

/* ==========================================================================
   Footer Status Bar
   ========================================================================== */
.app-footer {
  height: 30px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-sep {
  color: var(--border-darker);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online {
  background-color: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.dot.offline {
  background-color: #f59e0b;
}

#zoom-slider {
  width: 80px;
  height: 4px;
  cursor: pointer;
}

/* ==========================================================================
   Buttons & Generic Components
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.78rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--text-main);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background-color: var(--bg-surface);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.18s ease-out;
}

.modal-card.modal-sm {
  max-width: 420px;
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Right-Docked Drawer Modals (QR Code / Barcode, Shortcuts, Image & Symbols) */
#code-generator-modal,
#shortcuts-modal,
#image-modal,
#symbols-modal,
.modal-backdrop.modal-docked-right {
  justify-content: flex-end !important;
  align-items: stretch !important;
  padding: 0 !important;
  overflow: hidden;
}

#code-generator-modal > .modal-card,
#shortcuts-modal > .modal-card,
#image-modal > .modal-card,
#symbols-modal > .modal-card,
.modal-backdrop.modal-docked-right > .modal-card {
  height: 100vh !important;
  max-height: 100vh !important;
  width: 480px !important;
  max-width: 100vw !important;
  border-radius: 0 !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-left: 1px solid var(--border-color) !important;
  margin: 0 !important;
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.22) !important;
  animation: slideInRight 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: flex !important;
  flex-direction: column !important;
}

#shortcuts-modal .modal-body,
#code-generator-modal .modal-body,
#image-modal .modal-body,
#symbols-modal .modal-body {
  flex: 1 1 auto !important;
  max-height: none !important;
  overflow-y: auto !important;
}

#symbols-modal .symbols-grid-container {
  max-height: calc(100vh - 290px) !important;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.modal-subtext {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background-color: var(--bg-toolbar);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.85rem;
  background-color: var(--bg-surface);
  color: var(--text-main);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-color);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.drop-zone {
  border: 2px dashed var(--border-darker);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.drop-zone:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.drop-icon {
  font-size: 2rem;
  color: var(--primary-color);
}

/* Document Manager Items */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-list-item:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.doc-list-item.active {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.doc-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Page Setup & Toast Styles
   ========================================================================== */
.form-label-bold {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.radio-toggle-group {
  display: flex;
  gap: 12px;
}

.radio-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.radio-toggle-btn:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.radio-toggle-btn:has(input:checked) {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.radio-toggle-btn input[type="radio"] {
  display: none;
}

.margins-preset-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.margins-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.margin-input-col label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-input-swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-darker);
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

/* Toast Notification */
.app-toast {
  position: fixed;
  bottom: 42px;
  right: 24px;
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2000;
  animation: toastSlideUp 0.25s ease-out;
  transition: opacity 0.3s ease;
}

.app-toast.success {
  background-color: #065f46;
  border: 1px solid #059669;
}

@keyframes toastSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Print Stylesheet */
@media print {
  body {
    background: transparent !important;
  }
  .app-header, .menu-bar, .toolbar-container, .find-replace-bar, .ruler-top-row, .ruler-container, .ruler-corner, .ruler-vertical-container, .app-footer, .modal-backdrop, .doc-page-overlay, .auto-page-break-divider, .doc-hf-close {
    display: none !important;
  }
  .workspace, .workspace-body {
    overflow: visible !important;
  }
  .document-scroller {
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }
  .page-container {
    transform: none !important;
  }
  .document-page {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
  }
  /* Repeat header & footer across printed pages via fixed positioning */
  .doc-header-block {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 0;
    border-bottom: 1px solid #cbd5e1;
    background: white;
  }
  .doc-footer-block {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 0;
    border-top: 1px solid #cbd5e1;
    background: white;
  }
  /* Hide chart and smartart edit/delete toolbars and action controls when printing */
  .doc-chart-toolbar,
  .btn-doc-chart-edit,
  .btn-doc-chart-del,
  .smartart-block-toolbar,
  .smartart-btn-remove {
    display: none !important;
  }
  .doc-chart-embedded-block {
    border: none !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   Mobile & Tablet Responsiveness (Docs Editor)
   ========================================================================== */
@media screen and (max-width: 900px) {
  .suite-pills {
    display: none !important;
  }
  .ruler-top-row,
  .ruler-container,
  .ruler-corner,
  .ruler-vertical-container {
    display: none !important;
  }
}

@media screen and (max-width: 768px) {
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  .app-container {
    height: 100%;
    height: 100dvh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
  }

  /* Header optimizations */
  .app-header {
    height: auto;
    min-height: 48px;
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
    gap: 8px;
  }

  .app-title {
    display: none;
  }

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

  .doc-title-input {
    width: 100%;
    min-width: 120px;
    max-width: 180px;
    font-size: 0.88rem;
  }

  .status-indicator span {
    display: none;
  }

  .header-right {
    gap: 4px;
  }

  .btn-share span {
    display: none;
  }

  .btn-share {
    padding: 6px 10px;
  }

  /* Hide desktop menu bar on mobile */
  .menu-bar {
    display: none !important;
  }

  /* Dock toolbar at the bottom in mobile version */
  .toolbar-container {
    order: 99;
    position: relative;
    z-index: 1100;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    background: var(--bg-surface, #ffffff);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 8px 10px;
    padding-bottom: calc(max(10px, env(safe-area-inset-bottom)) + 6px);
    gap: 4px;
    scrollbar-width: none;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }

  .workspace {
    order: 10;
    flex: 1 1 0%;
    min-height: 0;
  }

  /* Hide app-footer on mobile so toolbar is the primary bottom element */
  .app-footer {
    display: none !important;
  }

  /* Ensure toolbar popups/dropdowns open upwards when docked at the bottom */
  .toolbar-dropdown-container .toolbar-grid-popup,
  .toolbar-dropdown-container .msword-list-gallery-popup,
  .toolbar-dropdown-container .dropdown-menu {
    top: auto !important;
    bottom: calc(100% + 4px) !important;
    margin-top: 0 !important;
    margin-bottom: 4px !important;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1050;
  }

  /* Table size picker: fixed, centered above the bottom toolbar so it is never clipped */
  .toolbar-dropdown-container .toolbar-grid-popup {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    top: auto !important;
    max-width: calc(100vw - 16px);
    overflow: visible;
  }

  .table-grid-picker {
    touch-action: none;
  }

  .toolbar-container::-webkit-scrollbar {
    display: none;
  }

  .toolbar-group {
    flex-shrink: 0;
  }

  .tool-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    flex-shrink: 0;
  }

  .tool-select,
  .tool-input {
    height: 30px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  /* Document viewport & page scaling */
  .document-scroller {
    padding: 12px 8px 60px 8px;
  }

  .page-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
  }

  .document-page {
    width: 100% !important;
    max-width: 100% !important;
    min-height: calc(100vh - 160px) !important;
    padding: 32px 18px !important;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    font-size: 10.5pt;
  }

  /* Find & replace bar responsive */
  .find-replace-bar {
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 8px;
  }

  .find-inputs {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  .find-actions {
    width: 100%;
    justify-content: space-between;
  }

  /* Modals fit neatly on mobile screens */
  .modal-card {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 8px;
    max-height: 90vh;
  }

  .modal-header {
    padding: 10px 14px;
  }

  .modal-body {
    padding: 12px 14px;
  }

  .modal-footer {
    padding: 10px 14px;
  }

  /* Footer bar */
  .app-footer {
    height: 28px;
    padding: 0 10px;
    font-size: 0.72rem;
  }

  .footer-right .zoom-controls {
    display: none;
  }
}

@media screen and (max-width: 480px) {
  .header-left {
    gap: 4px;
  }

  .logo-area {
    gap: 4px;
  }

  .doc-title-input {
    max-width: 130px;
    font-size: 0.82rem;
    padding: 2px 4px;
  }

  .document-scroller {
    padding: 8px 4px 50px 4px;
  }

  .document-page {
    padding: 22px 12px !important;
    font-size: 10pt;
  }

  /* Floating Image Toolbar mobile position */
  .image-floating-toolbar {
    left: 8px !important;
    right: 8px !important;
    transform: none !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
  }

  /* Toast alerts */
  .app-toast {
    left: 12px;
    right: 12px;
    bottom: 36px;
    text-align: center;
    justify-content: center;
  }
}

/* ==========================================================================
   PWA Installation Button
   ========================================================================== */
.btn-pwa-install,
#btn-pwa-install {
  display: none !important;
}



/* ==========================================================================
   MS Word Core Feature Extensions
   ========================================================================== */

/* 1. Format Painter */
.format-painter-cursor,
.format-painter-cursor * {
  cursor: copy !important;
}

.tool-btn.locked-active {
  background-color: #fef08a !important;
  color: #854d0e !important;
  border-color: #ca8a04 !important;
  box-shadow: 0 0 0 2px rgba(202, 138, 4, 0.35) !important;
}

/* 2. Non-Printing Formatting Marks (Pilcrow ¶) */
.show-formatting-marks p::after,
.show-formatting-marks h1::after,
.show-formatting-marks h2::after,
.show-formatting-marks h3::after,
.show-formatting-marks blockquote::after {
  content: " ¶";
  color: #94a3b8;
  font-size: 0.85em;
  font-weight: normal;
  pointer-events: none;
  user-select: none;
  opacity: 0.7;
}

.show-formatting-marks .doc-page-break::before {
  content: "········· Page Break ·········";
  display: block;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
  user-select: none;
}

/* 3. Drop Cap */
.doc-drop-cap {
  float: left;
  font-size: 3.5em;
  line-height: 0.8;
  padding-top: 4px;
  padding-right: 12px;
  padding-bottom: 2px;
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 700;
  color: var(--primary-color, #2563eb);
  user-select: text;
}

.doc-drop-cap.in-margin {
  margin-left: -1.25em;
}

.doc-drop-cap.drop-lines-2 {
  font-size: 2.5em;
  padding-right: 8px;
}

.doc-drop-cap.drop-lines-4 {
  font-size: 4.6em;
  padding-right: 14px;
}

/* 4. WordArt & Text Effects */
.doc-wordart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px 0;
  user-select: none;
  width: 100%;
}

.doc-wordart {
  display: inline-block;
  padding: 10px 22px;
  font-weight: 900;
  letter-spacing: 1.5px;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

.doc-wordart:hover {
  transform: scale(1.02);
}

.wordart-3d-blue {
  font-family: 'Montserrat', sans-serif;
  color: #2563eb;
  text-shadow: 0 1px 0 #1d4ed8, 0 2px 0 #1e40af, 0 3px 0 #1e3a8a, 0 4px 0 #172554, 0 6px 12px rgba(0,0,0,0.35);
}

.wordart-neon-glow {
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
  text-shadow: 0 0 5px #06b6d4, 0 0 10px #06b6d4, 0 0 20px #0891b2, 0 0 40px #ec4899;
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 28px;
}

.wordart-gold-emboss {
  font-family: 'Cinzel', 'Playfair Display', serif;
  background: linear-gradient(135deg, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 3px 2px rgba(0,0,0,0.4));
}

.wordart-retro-rainbow {
  font-family: 'Righteous', 'Poppins', cursive;
  background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #06b6d4, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.25));
}

.wordart-outline-modern {
  font-family: 'Inter', sans-serif;
  color: transparent;
  -webkit-text-stroke: 2.5px #2563eb;
  filter: drop-shadow(3px 3px 0px #93c5fd);
}

.wordart-sunset-wave {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, #f43f5e, #fb923c, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 10px rgba(244, 63, 94, 0.4));
}

.wordart-cyberpunk {
  font-family: 'Oswald', sans-serif;
  color: #ffffff;
  text-shadow: 2px 0 0 #06b6d4, -2px 0 0 #f43f5e, 0 2px 4px rgba(0,0,0,0.5);
  background: #18181b;
  border-radius: 6px;
  padding: 10px 24px;
}

.wordart-chrome-silver {
  font-family: 'Playfair Display', serif;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 45%, #64748b 55%, #f1f5f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.5));
}

/* 5. Text Box Styles */
.doc-text-box {
  margin: 18px 0;
  padding: 18px 22px;
  border-radius: 6px;
  position: relative;
  user-select: text;
  box-sizing: border-box;
}

.doc-text-box.box-simple {
  border: 1.5px solid var(--border-darker, #cbd5e1);
  background: var(--bg-surface, #ffffff);
  box-shadow: var(--shadow-sm);
}

.doc-text-box.box-quote-sidebar {
  border-left: 5px solid var(--primary-color, #2563eb);
  background: rgba(37, 99, 235, 0.04);
  font-style: italic;
  font-size: 1.05em;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.doc-text-box.box-callout {
  border: 1px solid #38bdf8;
  background: #f0f9ff;
  border-top: 4px solid #0284c7;
}

.doc-text-box.box-double-border {
  border: 3px double #64748b;
  background: #fafafa;
}

[data-theme="dark"] .doc-text-box.box-simple {
  background: var(--bg-surface);
  border-color: var(--border-color);
}
[data-theme="dark"] .doc-text-box.box-callout {
  background: rgba(2, 132, 199, 0.1);
  border-color: #0284c7;
}
[data-theme="dark"] .doc-text-box.box-double-border {
  background: #1e293b;
  border-color: #475569;
}

/* 6. MS Word Cover Page Templates */
.doc-cover-page {
  min-height: 960px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 48px;
  margin-bottom: 40px;
  border-bottom: 3px dashed #94a3b8;
  position: relative;
  box-sizing: border-box;
  page-break-after: always;
}

.cover-header-block {
  margin-bottom: 36px;
}

.cover-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  color: var(--text-main);
}

.cover-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 24px;
}

.cover-footer-block {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Executive Cover */
.doc-cover-page.cover-exec {
  background: linear-gradient(180deg, #1e3a8a 0%, #1e3a8a 220px, #ffffff 220px, #ffffff 100%);
  color: #1e293b;
}
.doc-cover-page.cover-exec .cover-header-block {
  color: #ffffff;
  padding-top: 24px;
}
.doc-cover-page.cover-exec .cover-header-block h1 {
  color: #ffffff;
}
.doc-cover-page.cover-exec .cover-header-block .cover-subtitle {
  color: #93c5fd;
}

/* Corporate Horizon Cover */
.doc-cover-page.cover-horizon {
  border-left: 12px solid #2563eb;
  padding-left: 56px;
}

/* Editorial Minimalist Cover */
.doc-cover-page.cover-minimal {
  text-align: center;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.doc-cover-page.cover-minimal .cover-rule {
  width: 120px;
  height: 2px;
  background: #1e293b;
  margin: 20px auto;
}

/* Creative Gradient Banner Cover */
.doc-cover-page.cover-creative {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(139, 92, 246, 0.08));
}
.doc-cover-page.cover-creative .cover-title {
  background: linear-gradient(135deg, #ec4899, #8b5cf6, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Academic Formal Cover */
.doc-cover-page.cover-academic {
  text-align: center;
  font-family: 'Times New Roman', Georgia, serif;
}
.doc-cover-page.cover-academic .cover-title {
  font-size: 2.4rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* 7. Page Borders */
.document-page.page-border-box {
  border: 2px solid var(--page-border-color, #1e293b) !important;
}
.document-page.page-border-shadow {
  border: 2px solid var(--page-border-color, #1e293b) !important;
  box-shadow: 8px 8px 0px rgba(0,0,0,0.2) !important;
}
.document-page.page-border-double {
  border: 4px double var(--page-border-color, #1e293b) !important;
}
.document-page.page-border-dashed {
  border: 2px dashed var(--page-border-color, #1e293b) !important;
}

/* 8. Watermark Overlay Presets */
.doc-watermark-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 5rem;
  font-weight: 800;
  color: rgba(148, 163, 184, 0.18);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 6px;
  line-height: 1;
}

.doc-watermark-overlay.horizontal {
  transform: translate(-50%, -50%) rotate(0deg);
}

/* 9. Extended Modals Styling */
.wordcount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.wordcount-stat-card {
  background: var(--bg-toolbar, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wordcount-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wordcount-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color, #2563eb);
}

.wordcount-extra-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 12px;
}

.wordcount-extra-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-color);
}
.wordcount-extra-row:last-child {
  border-bottom: none;
}

/* Keyboard Shortcuts Modal Styling */
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-section-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-color);
  padding: 4px 6px;
  background: var(--bg-toolbar);
  border-radius: 4px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.shortcut-row:last-child {
  border-bottom: none;
}

.kbd-pill {
  background-color: var(--bg-toolbar);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Date and Time list */
.datetime-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.datetime-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.15s ease;
}

.datetime-item:hover {
  border-color: var(--primary-color);
  background-color: var(--primary-light, #eff6ff);
}

.datetime-item.selected {
  border-color: var(--primary-color);
  background-color: var(--primary-light, #eff6ff);
  font-weight: 600;
}

/* Template Grids (WordArt, Text Box, Cover Page) */
.template-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.template-card {
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.15s ease;
  text-align: center;
  min-height: 80px;
}

.template-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.template-card.active {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.template-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
  color: var(--text-main);
}

/* Thesaurus UI */
.thesaurus-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thesaurus-group {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--bg-surface);
}

.thesaurus-pos-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-color);
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.thesaurus-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.synonym-pill {
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-toolbar);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.synonym-pill:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  transform: scale(1.04);
}

/* Sort dialog */
.sort-radio-group {
  display: flex;
  gap: 16px;
  margin: 10px 0;
}


/* ==========================================================================
   Google Docs Feature Suite Extensions for Infinity Docs
   ========================================================================== */

/* 1. Document Outline Sidebar */
.doc-outline-sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: width 0.2s ease, opacity 0.2s ease;
  z-index: 20;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.doc-outline-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-right: none;
}

.doc-outline-toggle-pill {
  position: absolute;
  left: 28px;
  top: 14px;
  z-index: 25;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
}

.doc-outline-toggle-pill:hover {
  color: var(--primary-color);
  transform: scale(1.08);
}

.outline-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.outline-summary-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.outline-summary-card textarea {
  width: 100%;
  height: 52px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-toolbar);
  color: var(--text-main);
  font-size: 0.78rem;
  padding: 6px;
  resize: none;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.outline-summary-card textarea:focus {
  border-color: var(--primary-color);
  background: var(--bg-surface);
}

.outline-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.outline-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outline-item:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.outline-item.h1 { font-weight: 600; padding-left: 10px; }
.outline-item.h2 { font-weight: 500; padding-left: 20px; color: var(--text-muted); }
.outline-item.h3 { font-weight: 400; padding-left: 30px; color: var(--text-muted); font-size: 0.78rem; }

.outline-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* 2. Smart Canvas @ and / Floating Popup Menu */
.smart-canvas-popup {
  position: absolute;
  width: 300px;
  max-height: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.12s ease-out;
}

.smart-canvas-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-toolbar);
}

.smart-canvas-section-title {
  padding: 6px 12px 2px 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.smart-canvas-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text-main);
  transition: background-color 0.1s ease;
}

.smart-canvas-item:hover,
.smart-canvas-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.smart-canvas-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: var(--bg-toolbar);
  color: var(--primary-color);
}

/* 3. Google Docs Smart Chips */
.doc-smart-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 500;
  background: #e2e8f0;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  user-select: none;
  vertical-align: middle;
  margin: 0 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-smart-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.doc-chip-date {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.doc-chip-person {
  background: #fdf2f8;
  color: #be185d;
  border-color: #fbcfe8;
}

.doc-chip-dropdown {
  cursor: pointer;
  position: relative;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.chip-arrow {
  font-size: 0.65rem;
  margin-left: 2px;
  opacity: 0.7;
}

.chip-dropdown-flyout {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  min-width: 150px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip-dropdown-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.12s;
  color: var(--text-main);
}

.chip-dropdown-opt:hover {
  background: var(--primary-light);
}

/* 4. Voice Typing Floating Pill Widget */
.voice-typing-pill {
  position: fixed;
  bottom: 50px;
  right: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1050;
  animation: modalPop 0.18s ease-out;
}

.voice-typing-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* 5. Google Docs Pageless Format */
.document-page.pageless-mode {
  width: 100% !important;
  max-width: 1050px !important;
  min-height: calc(100vh - 120px) !important;
  margin: 0 auto !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border: none !important;
  padding: 36px 48px !important;
}

.document-scroller.pageless-scroller {
  background: var(--bg-surface) !important;
  padding: 0 !important;
}

/* 6. Google Docs Building Blocks */
.doc-email-draft {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--bg-toolbar);
  padding: 16px;
  margin: 18px 0;
  user-select: text;
}

.email-draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.9rem;
}

.email-draft-field {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
  color: var(--text-main);
}

.email-draft-body {
  padding: 12px 0 4px 0;
  min-height: 80px;
  outline: none;
  font-size: 0.95rem;
}

/* 7. Version History Studio Dialog */
.version-history-dialog {
  width: 95vw;
  max-width: 1240px;
  height: 88vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.version-history-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.version-history-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f1f5f9;
}

[data-theme="dark"] .version-history-split {
  background: #0f172a;
}

/* Left Canvas Preview Pane */
.version-preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border-color);
  background: #f8fafc;
}

[data-theme="dark"] .version-preview-pane {
  background: #111827;
}

.version-preview-toolbar {
  padding: 10px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.version-preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--primary-light);
  color: var(--primary-color);
}

.version-preview-badge.is-current {
  background: #dcfce7;
  color: #15803d;
}

[data-theme="dark"] .version-preview-badge.is-current {
  background: #064e3b;
  color: #86efac;
}

.version-preview-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
}

.version-preview-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.version-preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.version-diff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-color);
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-hover);
}

.version-diff-toggle input[type="checkbox"] {
  cursor: pointer;
}

.version-preview-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.version-preview-page {
  width: 100%;
  max-width: 800px;
  min-height: 1000px;
  background: #ffffff;
  color: #1e293b;
  padding: 50px 60px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-family: inherit;
  font-size: 11pt;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
  user-select: text;
}

[data-theme="dark"] .version-preview-page {
  background: #1e293b;
  color: #f1f5f9;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Diff Highlighting */
.diff-added {
  background-color: #bbf7d0 !important;
  color: #14532d !important;
  text-decoration: none !important;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.diff-deleted {
  background-color: #fecaca !important;
  color: #991b1b !important;
  text-decoration: line-through !important;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0.85;
}

[data-theme="dark"] .diff-added {
  background-color: #064e3b !important;
  color: #86efac !important;
}

[data-theme="dark"] .diff-deleted {
  background-color: #7f1d1d !important;
  color: #fca5a5 !important;
}

/* Right Timeline Sidebar */
.version-timeline-sidebar {
  width: 360px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
}

.version-name-current-box {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.version-timeline-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
}

.version-timeline-search {
  position: relative;
  display: flex;
  align-items: center;
}

.version-timeline-search i {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.version-timeline-search input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-color);
  outline: none;
}

.version-timeline-search input:focus {
  border-color: var(--primary-color);
}

.version-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.version-filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.version-timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Timeline Card */
.version-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.version-card:hover {
  border-color: var(--primary-color);
  background: var(--bg-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.version-card.active {
  border-color: var(--primary-color);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.version-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.version-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.version-card-name .named-tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
  text-transform: uppercase;
}

[data-theme="dark"] .version-card-name .named-tag {
  background: #312e81;
  color: #c7d2fe;
}

.version-card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.version-card-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.version-card-delta {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 4px;
}

.version-card-delta.plus {
  background: #dcfce7;
  color: #15803d;
}

.version-card-delta.minus {
  background: #fee2e2;
  color: #b91c1c;
}

.version-card-delta.same {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.version-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.version-card-actions .btn-link {
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--primary-color);
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.version-card-actions .btn-link:hover {
  background: rgba(37, 99, 235, 0.1);
}

.version-card-actions .btn-link.danger {
  color: var(--danger-color);
}

.version-card-actions .btn-link.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================================
   Zoho Writer Feature Suite: Modes, Zia Assistant, Typewriter, Focus, Fillable
   ============================================================================ */

/* 1. Zoho Lifecycle Modes (Compose / Review / Distribute) */
.lifecycle-mode-switcher {
  display: inline-flex;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
  margin-right: 8px;
}

.lifecycle-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.lifecycle-mode-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.lifecycle-mode-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* Compose Mode: Distraction-free clean writing */
body.mode-compose .toolbar-container,
body.mode-compose .ruler-top-row,
body.mode-compose .ruler-vertical-container {
  display: none !important;
}

body.mode-compose .workspace-body {
  padding-top: 16px;
}

body.mode-compose #editor {
  border-color: transparent !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04) !important;
}

/* Distribute Mode: Clean presentation banner */
.distribute-mode-bar {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  color: #ffffff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideDown 0.2s ease-out;
}

.distribute-mode-bar .distribute-actions {
  display: flex;
  gap: 10px;
}

/* 2. Typewriter Mode (Mechanical sound & centered view) */
.tool-btn.typewriter-active,
.btn.typewriter-active {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #f59e0b !important;
}

/* 3. Focus Typing Mode (Dims non-active paragraphs) */
body.focus-mode-active #editor > * {
  opacity: 0.22;
  filter: blur(0.4px);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

body.focus-mode-active #editor > *.focus-active-block {
  opacity: 1 !important;
  filter: none !important;
}

/* 4. Zia Writing Assistant Sidebar */
.zia-assistant-panel {
  position: fixed;
  top: 90px;
  right: 0;
  bottom: 30px;
  width: 340px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.zia-assistant-panel.open {
  transform: translateX(0);
}

.zia-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(238, 77, 45, 0.05), rgba(37, 99, 235, 0.05));
}

.zia-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.zia-title .zia-sparkle {
  color: #ee4d2d;
  font-size: 1.1rem;
}

.zia-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zia-score-card {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.zia-score-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #10b981;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #10b981;
  flex-shrink: 0;
}

.zia-score-circle span {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: -3px;
  color: var(--text-muted);
}

.zia-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.zia-metric-item {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
}

.zia-metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.zia-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.zia-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zia-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zia-suggestion-card {
  border: 1px solid var(--border-color);
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--bg-surface);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.zia-suggestion-card:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.04);
}

.zia-suggestion-card.grammar { border-left-color: #ef4444; }
.zia-suggestion-card.readability { border-left-color: #f59e0b; }
.zia-suggestion-card.style { border-left-color: #8b5cf6; }

.zia-suggestion-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.zia-suggestion-text {
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 6px;
}

.zia-suggestion-action {
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 5. Fillable Fields / Mail Merge Fields (Zoho Forms / Sign) */
.doc-fillable-field {
  display: inline-block;
  background: #f1f5f9;
  border: 1.5px dashed #64748b;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.88em;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  vertical-align: middle;
}

.doc-fillable-field:hover {
  background: #e2e8f0;
  border-color: #2563eb;
  color: #1e40af;
}

.doc-fillable-field.signature-field {
  border-color: #9333ea;
  background: #faf5ff;
  color: #7e22ce;
}

.doc-fillable-field.signature-field i {
  margin-right: 4px;
}

.doc-merge-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.85em;
  font-family: monospace;
  font-weight: 600;
}

/* ==========================================================================
   Format Menu - Rich Paragraph Styles & Typography Previews
   ========================================================================== */

/* Submenu items with nested actions flyout */
.dropdown-submenu-item.has-nested-flyout {
  position: relative;
}

.dropdown-submenu-item.has-nested-flyout > .nested-style-flyout {
  display: none;
  position: absolute;
  top: -6px;
  left: 100%;
  min-width: 240px;
  z-index: 10050;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dropdown-submenu-item.has-nested-flyout:hover > .nested-style-flyout,
.dropdown-submenu-item.has-nested-flyout:focus-within > .nested-style-flyout {
  display: block !important;
}

/* Style flyout dropdown custom sizing */
.para-styles-flyout {
  min-width: 260px !important;
  max-height: 80vh;
  overflow-y: auto;
}

/* Preview rows */
.dropdown-item.para-style-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  min-height: 38px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.dropdown-item.para-style-row.active,
.dropdown-item.para-style-row:hover {
  background-color: var(--primary-light, #eff6ff) !important;
  color: var(--primary-color, #1a73e8) !important;
}

[data-theme="dark"] .dropdown-item.para-style-row.active,
[data-theme="dark"] .dropdown-item.para-style-row:hover {
  background-color: #1e293b !important;
  color: #60a5fa !important;
}

.para-style-preview {
  display: inline-flex;
  align-items: center;
  line-height: 1.25;
}

/* Specific Style Typography Previews matching user screenshot */
.style-preview-normal {
  font-size: 0.95rem;
  font-weight: 400;
  color: inherit;
}

.style-preview-title {
  font-size: 1.28rem;
  font-weight: 700;
  color: #1a73e8 !important;
  letter-spacing: -0.01em;
}

.style-preview-subtitle {
  font-size: 0.98rem;
  font-weight: 500;
  font-style: italic;
  color: #334155;
}
[data-theme="dark"] .style-preview-subtitle {
  color: #94a3b8;
}

.style-preview-h1 {
  font-size: 1.22rem;
  font-weight: 800;
  color: inherit;
}

.style-preview-h2 {
  font-size: 1.12rem;
  font-weight: 700;
  color: inherit;
}

.style-preview-h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: inherit;
}

.style-preview-h4 {
  font-size: 0.96rem;
  font-weight: 700;
  font-style: italic;
  color: inherit;
}

.style-preview-h5 {
  display: inline-block;
  background-color: #333333;
  color: #ffffff !important;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
}
[data-theme="dark"] .style-preview-h5 {
  background-color: #1f2937;
  color: #f3f4f6 !important;
  border: 1px solid #374151;
}

.style-preview-h6 {
  font-size: 0.92rem;
  font-weight: 600;
  font-style: italic;
  text-decoration: underline;
  color: inherit;
}

.style-preview-quote {
  font-size: 0.95rem;
  font-style: italic;
  color: inherit;
  border-left: 3px solid #1a73e8;
  padding-left: 8px;
}

/* Document content styles for H4, H5, H6, Title, Subtitle */
.document-page .doc-title,
.document-page h1.doc-title {
  font-size: 28pt !important;
  font-weight: 700 !important;
  color: #1a73e8 !important;
  margin-top: 1.2em;
  margin-bottom: 0.3em;
  line-height: 1.2;
}

.document-page .doc-subtitle,
.document-page p.doc-subtitle {
  font-size: 15pt !important;
  font-style: italic !important;
  color: #475569 !important;
  margin-bottom: 0.8em;
}

[data-theme="dark"] .document-page .doc-subtitle,
[data-theme="dark"] .document-page p.doc-subtitle {
  color: #94a3b8 !important;
}

.document-page h4 {
  font-size: 12pt;
  font-weight: 700;
  font-style: italic;
  margin-top: 0.9em;
  margin-bottom: 0.3em;
}

.document-page h5 {
  display: inline-block;
  background-color: #333333;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11pt;
  font-weight: 600;
  margin-top: 0.8em;
  margin-bottom: 0.3em;
}
[data-theme="dark"] .document-page h5 {
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
}

.document-page h6 {
  font-size: 10.5pt;
  font-weight: 600;
  font-style: italic;
  text-decoration: underline;
  margin-top: 0.8em;
  margin-bottom: 0.3em;
}

/* ==========================================================================
   Right-Side Format & Paragraph Options Sidebar
   ========================================================================== */
.doc-format-sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--bg-surface, #ffffff);
  border-left: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  z-index: 25;
  overflow: hidden;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.doc-format-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-left: none;
}

.format-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
}

.format-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color, #1e293b);
}

.format-sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.format-sidebar-close:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-color, #0f172a);
}

.format-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
  overflow-x: auto;
  scrollbar-width: none;
}

.format-sidebar-tabs::-webkit-scrollbar {
  display: none;
}

.format-sidebar-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.format-sidebar-tab:hover {
  color: var(--text-color, #0f172a);
}

.format-sidebar-tab.active {
  color: var(--primary-color, #1a73e8);
  border-bottom-color: var(--primary-color, #1a73e8);
  background: var(--bg-surface, #ffffff);
}

.format-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.format-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.format-sidebar-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.format-sidebar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.format-sidebar-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.format-sidebar-field label {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

.format-sidebar-input,
.format-sidebar-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-surface, #ffffff);
  color: var(--text-color, #0f172a);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.format-sidebar-input:focus,
.format-sidebar-select:focus {
  border-color: var(--primary-color, #1a73e8);
}

.format-btn-group {
  display: flex;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-surface, #ffffff);
}

.format-btn-group button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 10px;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color, #cbd5e1);
  transition: background 0.15s, color 0.15s;
}

.format-btn-group button:last-child {
  border-right: none;
}

.format-btn-group button:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-color, #0f172a);
}

.format-btn-group button.active {
  background: var(--primary-light, #eff6ff);
  color: var(--primary-color, #1a73e8);
}

.format-sidebar-styles-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.format-sidebar-style-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  background: var(--bg-surface, #ffffff);
  cursor: pointer;
  transition: all 0.15s ease;
}

.format-sidebar-style-card:hover {
  border-color: var(--primary-color, #1a73e8);
  background: var(--primary-light, #eff6ff);
}

.format-sidebar-style-card.active {
  border-color: var(--primary-color, #1a73e8);
  background: var(--primary-light, #eff6ff);
}

.format-sidebar-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.format-sidebar-action-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-surface, #ffffff);
  color: var(--text-color, #1e293b);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.format-sidebar-action-btn:hover {
  background: var(--bg-hover, #f1f5f9);
  border-color: var(--primary-color, #1a73e8);
  color: var(--primary-color, #1a73e8);
}

.format-sidebar-action-btn.text-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

/* Table Sidebar Controls */
.table-sidebar-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.table-border-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Visual highlight for selected table cells in editor */
.document-page table td.selected-cell,
.document-page table th.selected-cell {
  background-color: rgba(59, 130, 246, 0.18) !important;
  outline: 2px solid #3b82f6 !important;
  outline-offset: -2px;
}

[data-theme="dark"] .doc-format-sidebar {
  background: #0f172a;
  border-left-color: #334155;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .format-sidebar-header {
  background: #0f172a;
  border-bottom-color: #334155;
}

[data-theme="dark"] .format-sidebar-title {
  color: #f8fafc;
}

[data-theme="dark"] .format-sidebar-tabs {
  background: #1e293b;
  border-bottom-color: #334155;
}

[data-theme="dark"] .format-sidebar-tab.active {
  background: #0f172a;
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

[data-theme="dark"] .format-sidebar-input,
[data-theme="dark"] .format-sidebar-select,
[data-theme="dark"] .format-btn-group,
[data-theme="dark"] .format-sidebar-style-card,
[data-theme="dark"] .format-sidebar-action-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

[data-theme="dark"] .format-btn-group button {
  border-right-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .format-btn-group button:hover {
  background: #334155;
  color: #f8fafc;
}

[data-theme="dark"] .format-btn-group button.active {
  background: #1e3a8a;
  color: #93c5fd;
}

[data-theme="dark"] .format-sidebar-style-card.active,
[data-theme="dark"] .format-sidebar-style-card:hover {
  background: #1e293b;
  border-color: #60a5fa;
}

/* ==========================================================================
   Document Color Sets & Design Presets (Zoho Writer Style)
   ========================================================================== */
.doc-color-set-flyout {
  min-width: 270px !important;
  max-width: 320px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 0 0 0 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.color-set-presets-header {
  padding: 8px 14px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.color-set-presets-header .presets-line {
  flex: 1;
  height: 1px;
  background: var(--border-color, #e2e8f0);
}

.doc-color-set-row {
  padding: 8px 14px !important;
  cursor: pointer;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px;
  border-left: 3px solid transparent;
  transition: all 0.12s ease;
}

.doc-color-set-row:hover {
  background-color: var(--bg-hover, #f1f5f9) !important;
}

.doc-color-set-row.active {
  border-left-color: var(--primary-color, #2563eb);
  background-color: var(--primary-light, rgba(37, 99, 235, 0.08)) !important;
}

.color-set-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.doc-color-set-row.active .color-set-header-line {
  font-weight: 600;
  color: var(--primary-color, #2563eb);
}

.color-set-check {
  font-size: 0.8rem;
  color: var(--primary-color, #2563eb);
}

.color-set-swatches {
  display: flex;
  gap: 3px;
  align-items: center;
  width: 100%;
}

.color-swatch-box {
  flex: 1;
  height: 14px;
  min-width: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  transition: transform 0.12s ease;
}

.doc-color-set-row:hover .color-swatch-box {
  transform: scaleY(1.1);
}

[data-theme="dark"] .color-swatch-box {
  border-color: rgba(255, 255, 255, 0.18);
}

.color-set-bottom-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-surface, #ffffff);
  border-top: 1px solid var(--border-color, #e2e8f0);
  padding: 4px;
  z-index: 10;
}

.btn-add-color-set {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--primary-color, #2563eb);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}

.btn-add-color-set:hover {
  background-color: var(--bg-hover, #f1f5f9);
}

.btn-add-color-set i {
  color: #22c55e;
  font-size: 1rem;
}

/* Live Font & Format Preview Selection Highlight */
@supports (selector(::highlight(test))) {
  ::highlight(doc-selection-preserve) {
    background-color: rgba(59, 130, 246, 0.35);
    color: inherit;
  }
}

.doc-live-font-preview {
  background-color: rgba(59, 130, 246, 0.35) !important;
  border-radius: 2px;
}

[data-theme="dark"] .doc-live-font-preview {
  background-color: rgba(59, 130, 246, 0.45) !important;
  border-radius: 2px;
}

/* Document Selection Overlay (Google Docs-style persistent visual highlight) */
#doc-selection-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.doc-selection-overlay-rect {
  position: absolute;
  background-color: rgba(59, 130, 246, 0.35);
  border-radius: 2px;
  pointer-events: none;
}

[data-theme="dark"] .doc-selection-overlay-rect {
  background-color: rgba(59, 130, 246, 0.45);
}

/* Select2 Font dropdown - Hide empty search field */
.select2-font-dropdown .select2-search,
.select2-font-dropdown .select2-search--dropdown {
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

@media print {
  #doc-selection-overlay {
    display: none !important;
  }
}

/* ==========================================================================
   Header & Footer Right Sidebar Panel & Inline Page Editor (Image 1 & 2)
   ========================================================================== */
.doc-header-footer-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--bg-surface, #ffffff);
  border-left: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  z-index: 25;
  overflow-y: auto;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

.doc-header-footer-sidebar *,
.doc-header-footer-sidebar *::before,
.doc-header-footer-sidebar *::after {
  box-sizing: border-box;
}

.doc-header-footer-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  opacity: 0;
  pointer-events: none;
  border-left: none;
}

.hf-sidebar-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-surface, #ffffff);
}

.hf-top-mode-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.hf-mode-title {
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hf-top-divider {
  color: #cbd5e1;
}

.hf-top-tab {
  color: var(--text-color, #1e293b);
  font-weight: 500;
}

.hf-sidebar-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.hf-sidebar-close:hover {
  color: #ef4444;
  background-color: #fee2e2;
}

.hf-sidebar-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hf-sidebar-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
  margin: 0;
}

.hf-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hf-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-color, #1e293b);
}

/* Presets row */
.hf-presets-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
}

.hf-preset-btn-container {
  position: relative;
}

.hf-preset-btn {
  width: 100%;
  border: 1.5px solid var(--border-color, #cbd5e1);
  background: var(--bg-surface, #ffffff);
  border-radius: 6px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hf-preset-btn:hover {
  border-color: #93c5fd;
  background-color: #f8fafc;
}

.hf-preset-btn.active {
  border-color: #2563eb !important;
  background-color: #eff6ff !important;
}

.hf-preset-btn.active .hf-preset-caret {
  transform: rotate(180deg);
}

.hf-preset-label-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-color, #1e293b);
}

.hf-preset-caret {
  font-size: 0.65rem;
  color: #2563eb;
  transition: transform 0.15s ease;
}

/* Presets popover menu (Image 1) */
.hf-presets-menu {
  display: none;
  position: fixed;
  width: 330px;
  max-width: 92vw;
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg-surface, #ffffff);
  border: 1.5px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  box-shadow: -4px 12px 36px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 99999;
  padding: 12px;
  flex-direction: column;
  gap: 10px;
}

.hf-presets-menu.open {
  display: flex !important;
}

.hf-preset-item {
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.12s ease;
}

.hf-preset-item:hover,
.hf-preset-item.active {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.hf-preview-blank {
  height: 18px;
  border-bottom: 2px solid #64748b;
}

.hf-preview-left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 4px;
}

.hf-preview-text {
  font-size: 0.74rem;
  color: #334155;
  font-weight: 600;
}

.hf-preview-split3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #334155;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 4px;
}

.hf-preview-badge-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 4px;
}

.hf-preview-badge {
  background-color: #dc2626;
  color: #ffffff;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.4px;
}

.hf-preview-right-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 4px;
  font-size: 0.72rem;
  color: #334155;
  font-weight: 600;
}

.hf-preview-right-line::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 14px;
  background-color: #0f172a;
}

.hf-preview-center {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.74rem;
  color: #334155;
  font-weight: 600;
  border-top: 1.5px solid #cbd5e1;
  padding-top: 4px;
}

.hf-preview-split2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #334155;
  font-weight: 600;
  border-top: 1.5px solid #cbd5e1;
  padding-top: 4px;
}

/* Options Checkboxes */
.hf-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-color, #1e293b);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.hf-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* Elements Grid (Matching Image 2 - 2 Columns) */
.hf-elements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background-color: var(--border-color, #cbd5e1);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  overflow: hidden;
}

.hf-element-btn {
  background: var(--bg-surface, #ffffff);
  border: none;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-color, #334155);
  text-align: center;
  transition: all 0.12s ease;
  font-family: inherit;
}

.hf-element-btn:hover {
  background-color: #f0f7ff;
  color: #1d4ed8;
}

.hf-elem-icon {
  font-size: 1.35rem;
}

.hf-badge-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.hf-mini-badge {
  position: absolute;
  top: -2px;
  right: -7px;
  font-size: 0.8rem;
  font-weight: 800;
}

.hf-mini-badge-date {
  position: absolute;
  bottom: 0px;
  font-size: 0.65rem;
  font-weight: 800;
}

.hf-mini-badge-123 {
  position: absolute;
  bottom: -4px;
  right: -9px;
  font-size: 0.6rem;
  font-weight: 800;
}

.hf-btn-with-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

/* Distance From Edge */
.hf-distance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background-color: var(--border-color, #cbd5e1);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  overflow: hidden;
}

.hf-distance-field {
  background: var(--bg-surface, #ffffff);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hf-distance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted, #475569);
  font-weight: 600;
}

.hf-distance-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hf-distance-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-color, #0f172a);
}

.hf-stepper-btn {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.hf-stepper-btn:hover {
  background-color: #eff6ff;
}

/* In-Page Header and Footer Interactive Zones & Guidelines (Image 1) */
.doc-page-header-zone,
.doc-page-footer-zone {
  position: absolute;
  z-index: 20;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  pointer-events: none;
}

.doc-page-header-zone:hover,
.doc-page-footer-zone:hover {
  background-color: rgba(59, 130, 246, 0.05);
}

.doc-page-header-zone.editing,
.doc-page-footer-zone.editing {
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
  z-index: 30;
  cursor: text;
  pointer-events: auto;
}

/* Guideline line across page */
.doc-hf-guideline {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-bottom: 1.5px dashed #60a5fa;
  pointer-events: none;
  display: none;
}

.doc-page-header-zone.editing .doc-hf-guideline {
  bottom: 0;
  display: block;
}

.doc-page-footer-zone.editing .doc-hf-guideline {
  top: 0;
  display: block;
}

/* Yellow floating action pills matching Image 1 */
.doc-hf-floating-toolbar {
  position: absolute;
  display: none;
  align-items: center;
  gap: 4px;
  z-index: 40;
  pointer-events: auto;
}

.doc-page-header-zone.editing .doc-hf-floating-toolbar {
  display: flex;
  top: calc(100% + 4px);
  left: 0;
}

.doc-page-footer-zone.editing .doc-hf-floating-toolbar {
  display: flex;
  bottom: calc(100% + 4px);
  left: 0;
}

.doc-hf-pill {
  background: #fef08a;
  border: 1px solid #facc15;
  color: #854d0e;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.12s ease;
  user-select: none;
}

.doc-hf-pill:hover {
  background: #fde047;
  border-color: #eab308;
  color: #713f12;
}

.doc-hf-editable-content {
  width: 100%;
  height: 100%;
  outline: none;
  display: flex;
  align-items: center;
  min-height: 24px;
  font-size: 0.85rem;
  color: var(--text-color, #475569);
  font-family: inherit;
  white-space: pre-wrap;
  user-select: text;
}

.doc-page-header-zone.editing .doc-hf-editable-content:empty::before,
.doc-page-footer-zone.editing .doc-hf-editable-content:empty::before,
.doc-page-header-zone:hover .doc-hf-editable-content:empty::before,
.doc-page-footer-zone:hover .doc-hf-editable-content:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

.doc-page-header-zone:not(.editing):not(:hover) .doc-hf-editable-content:empty::before,
.doc-page-footer-zone:not(.editing):not(:hover) .doc-hf-editable-content:empty::before {
  content: '' !important;
  display: none !important;
}

/* Header & Footer Mobile Direct Editor (Hidden on Desktop, Visible on Mobile <= 768px) */
.hf-mobile-direct-editor {
  display: none;
  background: var(--bg-surface, #ffffff);
  border: 1.5px solid var(--primary-color, #2563eb);
  border-radius: 8px;
  padding: 10px;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
  margin-bottom: 6px;
}

.hf-mobile-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hf-mobile-edit-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-color, #2563eb);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hf-mobile-edit-target {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
}

.hf-mobile-edit-textarea {
  min-height: 64px;
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-color, #1e293b);
  background: var(--bg-input, #ffffff);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.hf-mobile-edit-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hf-mobile-edit-textarea:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-style: italic;
  pointer-events: none;
}

.hf-mobile-edit-actions {
  display: flex;
  justify-content: flex-end;
}

.hf-mobile-btn-save {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.15s ease;
}

.hf-mobile-btn-save:hover {
  background: #1d4ed8;
}

/* Dark mode styling for Header & Footer Sidebar */
[data-theme="dark"] .doc-header-footer-sidebar {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .hf-sidebar-top-bar {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .hf-sidebar-heading {
  color: #f8fafc;
}

[data-theme="dark"] .hf-section-title {
  color: #cbd5e1;
}

[data-theme="dark"] .hf-top-tab {
  color: #e2e8f0;
}

[data-theme="dark"] .hf-preset-btn {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .hf-preset-label-row {
  color: #e2e8f0;
}

[data-theme="dark"] .hf-preset-btn:hover {
  background-color: #334155;
  border-color: #60a5fa;
}

[data-theme="dark"] .hf-preset-btn.active {
  background-color: rgba(37, 99, 235, 0.2) !important;
  border-color: #3b82f6 !important;
}

[data-theme="dark"] .hf-presets-menu {
  background: #1e293b;
  border-color: #475569;
}

[data-theme="dark"] .hf-preset-item {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .hf-preview-text,
[data-theme="dark"] .hf-preview-split3,
[data-theme="dark"] .hf-preview-split2,
[data-theme="dark"] .hf-preview-center,
[data-theme="dark"] .hf-preview-right-line {
  color: #e2e8f0;
}

[data-theme="dark"] .hf-checkbox-label {
  color: #e2e8f0;
}

[data-theme="dark"] .hf-element-btn {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .hf-element-btn:hover {
  background-color: #334155;
  color: #60a5fa;
}

[data-theme="dark"] .hf-elements-grid,
[data-theme="dark"] .hf-distance-row {
  background-color: #334155;
  border-color: #334155;
}

[data-theme="dark"] .hf-distance-field {
  background: #1e293b;
}

[data-theme="dark"] .hf-distance-header {
  color: #94a3b8;
}

[data-theme="dark"] .hf-distance-val {
  color: #f8fafc;
}

[data-theme="dark"] .doc-page-header-zone.editing,
[data-theme="dark"] .doc-page-footer-zone.editing {
  background-color: rgba(15, 23, 42, 0.98);
}

/* Dark mode for Mobile Direct Editor */
[data-theme="dark"] .hf-mobile-direct-editor {
  background: #1e293b;
  border-color: #3b82f6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hf-mobile-edit-label {
  color: #60a5fa;
}

[data-theme="dark"] .hf-mobile-edit-target {
  background: rgba(37, 99, 235, 0.3);
  color: #93c5fd;
  border-color: #3b82f6;
}

[data-theme="dark"] .hf-mobile-edit-textarea {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .hf-mobile-edit-textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* Mobile Media Query for Header & Footer Sidebar */
@media screen and (max-width: 768px) {
  .doc-header-footer-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-left: none;
    border-top: 1px solid var(--border-color, #e2e8f0);
  }

  .hf-mobile-direct-editor {
    display: flex;
  }
}










/* ==========================================================================
   MS Word Bullet & Numbering Styles & Gallery Popups
   ========================================================================== */

/* 1. MS Word List Rendering Styles in Document Canvas */
.document-page ul,
.document-scroller ul,
#editor ul {
  padding-left: 28px;
  margin: 6px 0;
}

.document-page ol,
.document-scroller ol,
#editor ol {
  padding-left: 28px;
  margin: 6px 0;
}

.document-page li,
.document-scroller li,
#editor li {
  margin: 3px 0;
  line-height: 1.5;
}

/* Bullet Varieties */
ul[data-bullet-style="disc"],
ul.msword-bullet-disc {
  list-style-type: disc !important;
}

ul[data-bullet-style="circle"],
ul.msword-bullet-circle {
  list-style-type: circle !important;
}

ul[data-bullet-style="square"],
ul.msword-bullet-square {
  list-style-type: square !important;
}

ul[data-bullet-style="hyphen"],
ul.msword-bullet-hyphen {
  list-style-type: "- " !important;
}

ul[data-bullet-style="check"],
ul.msword-bullet-check {
  list-style-type: "\2713  " !important;
}

ul[data-bullet-style="arrow"],
ul.msword-bullet-arrow {
  list-style-type: "\27A4  " !important;
}

ul[data-bullet-style="diamond"],
ul.msword-bullet-diamond {
  list-style-type: "\25C6  " !important;
}

ul[data-bullet-style="star"],
ul.msword-bullet-star {
  list-style-type: "\2605  " !important;
}

/* Numbering Varieties */
ol[data-number-style="decimal-dot"],
ol.msword-num-decimal-dot {
  list-style-type: decimal !important;
}

ol[data-number-style="decimal-paren"],
ol.msword-num-decimal-paren {
  list-style-type: none !important;
  counter-reset: msword-paren-counter;
}

ol[data-number-style="decimal-paren"] > li,
ol.msword-num-decimal-paren > li {
  counter-increment: msword-paren-counter;
  position: relative;
  list-style-type: none !important;
}

ol[data-number-style="decimal-paren"] > li::before,
ol.msword-num-decimal-paren > li::before {
  content: counter(msword-paren-counter) ") ";
  position: absolute;
  right: 100%;
  padding-right: 8px;
  font-weight: 500;
}

ol[data-number-style="upper-roman"],
ol.msword-num-upper-roman {
  list-style-type: upper-roman !important;
}

ol[data-number-style="lower-roman"],
ol.msword-num-lower-roman {
  list-style-type: lower-roman !important;
}

ol[data-number-style="upper-alpha-dot"],
ol.msword-num-upper-alpha-dot {
  list-style-type: upper-alpha !important;
}

ol[data-number-style="lower-alpha-dot"],
ol.msword-num-lower-alpha-dot {
  list-style-type: lower-alpha !important;
}

ol[data-number-style="lower-alpha-paren"],
ol.msword-num-lower-alpha-paren {
  list-style-type: none !important;
  counter-reset: msword-alpha-paren-counter;
}

ol[data-number-style="lower-alpha-paren"] > li,
ol.msword-num-lower-alpha-paren > li {
  counter-increment: msword-alpha-paren-counter;
  position: relative;
  list-style-type: none !important;
}

ol[data-number-style="lower-alpha-paren"] > li::before,
ol.msword-num-lower-alpha-paren > li::before {
  content: counter(msword-alpha-paren-counter, lower-alpha) ") ";
  position: absolute;
  right: 100%;
  padding-right: 8px;
  font-weight: 500;
}

ol[data-number-style="decimal-leading-zero"],
ol.msword-num-decimal-leading-zero {
  list-style-type: decimal-leading-zero !important;
}

/* 2. MS Word Gallery Popups (Matching Word 365 / Ribbon Dropdowns) */
.msword-list-gallery-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  width: 290px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  z-index: 100050;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.msword-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.msword-gallery-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  display: flex;
  align-items: center;
  gap: 6px;
}

.msword-gallery-title i {
  color: var(--primary-color, #2563eb);
}

.msword-gallery-subtitle {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.msword-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px 0;
}

.msword-gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 4px;
  background: var(--bg-surface, #ffffff);
  cursor: pointer;
  transition: all 0.12s ease;
}

.msword-gallery-item:hover {
  border-color: var(--primary-color, #2563eb);
  background-color: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.12);
}

.msword-gallery-item.active {
  border-color: var(--primary-color, #2563eb);
  background-color: #dbeafe;
}

.msword-bullet-preview-box {
  width: 54px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 3px;
  border: 1px dashed #cbd5e1;
}

.msword-bullet-glyph {
  font-size: 1.35rem;
  line-height: 1;
  color: #1e293b;
}

.msword-glyph-check {
  color: #10b981;
  font-weight: 700;
}

.msword-glyph-star {
  color: #f59e0b;
}

.msword-none-symbol {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}

.msword-item-label {
  font-size: 0.68rem;
  color: var(--text-muted, #475569);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Numbering preview cards */
.msword-number-sample-box {
  width: 68px;
  height: 48px;
  background: #f8fafc;
  border-radius: 3px;
  border: 1px dashed #cbd5e1;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.msword-num-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.msword-num-row span {
  font-size: 0.62rem;
  font-weight: 700;
  color: #1e293b;
  min-width: 14px;
}

.msword-line-placeholder {
  flex: 1;
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
}

.msword-gallery-footer {
  padding-top: 6px;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

.msword-gallery-action-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--primary-color, #2563eb);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  transition: background-color 0.12s ease;
}

.msword-gallery-action-btn:hover {
  background-color: #eff6ff;
}

/* 3. Custom Bullet Picker Grid in Modal */
.bullet-char-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-surface-secondary, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.bullet-char-opt {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.bullet-char-opt:hover {
  border-color: var(--primary-color, #2563eb);
  background-color: #eff6ff;
  transform: scale(1.08);
}

.bullet-char-opt.selected {
  border-color: var(--primary-color, #2563eb);
  background-color: #dbeafe;
  outline: 2px solid var(--primary-color, #2563eb);
}

/* Dark Mode Overrides */
[data-theme="dark"] .msword-list-gallery-popup {
  background: #0f172a;
  border-color: #334155;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .msword-gallery-header,
[data-theme="dark"] .msword-gallery-footer {
  border-color: #334155;
}

[data-theme="dark"] .msword-gallery-item {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .msword-gallery-item:hover {
  background-color: #1e3a8a;
  border-color: #3b82f6;
}

[data-theme="dark"] .msword-bullet-preview-box,
[data-theme="dark"] .msword-number-sample-box {
  background: #0f172a;
  border-color: #475569;
}

[data-theme="dark"] .msword-bullet-glyph,
[data-theme="dark"] .msword-num-row span {
  color: #f1f5f9;
}

[data-theme="dark"] .msword-item-label {
  color: #94a3b8;
}

[data-theme="dark"] .bullet-char-picker-grid {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .bullet-char-opt {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .bullet-char-opt:hover {
  background-color: #1e3a8a;
  border-color: #3b82f6;
}


/* Mobile essential actions button visibility */
.mobile-only-group {
  display: none !important;
}

@media screen and (max-width: 768px) {
  .mobile-only-group {
    display: flex !important;
  }
}

/* Voice Typing Pill Language Selector */
.voice-typing-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.voice-typing-lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.voice-typing-lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  color: var(--text-color, #1e293b);
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 20px 2px 6px;
  cursor: pointer;
  outline: none;
  max-width: 155px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  transition: all 0.15s ease;
}

.voice-typing-lang-select:hover {
  border-color: #2563eb;
}

.voice-typing-lang-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.voice-typing-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.voice-typing-close:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .voice-typing-lang-select {
  background-color: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .voice-typing-lang-select:hover {
  border-color: #60a5fa;
}

[data-theme="dark"] .voice-typing-lang-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}


/* ==========================================================================
   Template Miniature Preview Thumbnails (Shared)
   ========================================================================== */
.template-preview-frame {
  height: 150px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 10px;
}
.template-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.template-badge.docs { background: #2563eb; color: #fff; }
.template-badge.sheets { background: #107c41; color: #fff; }
.template-badge.slides { background: #ea580c; color: #fff; }

.preview-mini-doc {
  width: 125px;
  height: 130px;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease;
}
.tmpl-card-item:hover .preview-mini-doc,
.tcard:hover .preview-mini-doc,
.tcard:hover .preview-mini-sheet,
.tcard:hover .preview-mini-slide {
  transform: translateY(-2px) scale(1.02);
}
.p-bar { height: 4px; border-radius: 2px; background: #e2e8f0; }
.p-bar.title { height: 6px; width: 65%; background: #2563eb; margin-bottom: 2px; }
.p-bar.sub { height: 3.5px; width: 45%; background: #94a3b8; margin-bottom: 3px; }
.p-bar.w100 { width: 100%; }
.p-bar.w90 { width: 90%; }
.p-bar.w80 { width: 80%; }
.p-bar.w70 { width: 70%; }
.p-bar.w60 { width: 60%; }
.p-bar.w50 { width: 50%; }
.p-bar.w40 { width: 40%; }
.p-bar.w30 { width: 30%; }
.p-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 2px 0; }
.p-row-sidebar { display: grid; grid-template-columns: 28px 1fr; gap: 4px; height: 100%; }
.p-sidebar-col { background: #f1f5f9; border-radius: 2px; padding: 3px 2px; display: flex; flex-direction: column; gap: 3px; }
.p-avatar-circle { width: 14px; height: 14px; border-radius: 50%; background: #cbd5e1; margin: 0 auto 2px; }
.p-mini-table { width: 100%; border-collapse: collapse; margin: 2px 0; border-radius: 2px; overflow: hidden; }
.p-mini-table th, .p-mini-table td { padding: 2px 2.5px; font-size: 5px; border: 1px solid #e2e8f0; line-height: 1; }
.p-mini-table th { background: #eff6ff; font-weight: 700; color: #1e40af; }
