/* ==========================================================================
   MICROSOFT WORD — THÈME BLANC & ORANGE
   ========================================================================== */

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

:root {
  /* Palette Officielle Blanc & Orange */
  --word-orange-dark: #c2410c;
  --word-orange: #ea580c;
  --word-orange-light: #f97316;
  --word-orange-hover: #fb923c;
  --word-orange-subtle: #fff7ed;
  --word-orange-border: #fed7aa;

  /* Teintes Neutres Office 365 */
  --office-white: #ffffff;
  --office-gray-bg: #edebe9;
  --office-gray-10: #faf9f8;
  --office-gray-20: #f3f2f1;
  --office-gray-30: #e1dfdd;
  --office-gray-40: #c8c6c4;
  --office-gray-50: #a19f9d;
  --office-gray-60: #605e5c;
  --office-gray-70: #323130;
  --office-gray-80: #201f1e;

  /* Typographie Microsoft Office */
  --font-office-ui: "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-word-body: Calibri, Aptos, "Segoe UI", Arial, sans-serif;

  /* Dimensions */
  --titlebar-height: 44px;
  --ribbon-tabs-height: 34px;
  --ribbon-content-height: 98px;
  --ruler-height: 24px;
  --statusbar-height: 26px;
  --navpane-width: 290px;

  /* Facteur de zoom dynamique */
  --zoom-factor: 1;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-office-ui);
  background: var(--office-gray-bg);
  color: var(--office-gray-80);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* --------------------------------------------------------------------------
   1. BARRE DE TITRE WORD (Title Bar)
   -------------------------------------------------------------------------- */

#word-titlebar {
  height: var(--titlebar-height);
  background: var(--office-white);
  border-bottom: 1px solid var(--office-gray-30);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
  z-index: 40;
}

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

.word-brand {
  margin-right: 6px;
  display: flex;
  align-items: center;
}

.word-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--word-orange);
  color: var(--office-white);
  font-weight: 800;
  font-size: 15px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.4);
}

.qa-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--office-gray-70);
  padding: 5px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qa-btn:hover {
  background: var(--office-gray-20);
  color: var(--word-orange);
}

.titlebar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.title-input-wrap {
  display: flex;
  align-items: center;
}

#doc-name {
  font-family: var(--font-office-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--office-gray-80);
  text-align: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 1px 6px;
  width: 220px;
  outline: none;
  transition: all 0.15s ease;
}

#doc-name:hover {
  background: var(--office-gray-20);
}

#doc-name:focus {
  background: var(--office-white);
  border-color: var(--word-orange);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

.title-extension {
  font-size: 12px;
  color: var(--office-gray-50);
  margin-left: 1px;
}

.save-status-badge {
  font-size: 10.5px;
  color: var(--office-gray-60);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -2px;
}

.save-check {
  color: #10b981;
  font-weight: bold;
}

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

.word-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--office-gray-20);
  border: 1px solid var(--office-gray-30);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--office-gray-60);
  width: 170px;
  transition: all 0.15s ease;
}

.word-search-bar:focus-within {
  width: 230px;
  background: var(--office-white);
  border-color: var(--word-orange);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

.word-search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  width: 100%;
  color: var(--office-gray-80);
}

.titlebar-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--office-gray-70);
  display: flex;
  align-items: center;
}

.titlebar-btn:hover {
  background: var(--office-gray-20);
  color: var(--word-orange);
}

.copilot-pill {
  background: var(--word-orange-subtle);
  border: 1px solid var(--word-orange-border);
  color: var(--word-orange-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.copilot-pill:hover {
  background: var(--word-orange);
  color: var(--office-white);
  border-color: var(--word-orange);
}

.copilot-sparkle {
  font-size: 13px;
  color: var(--word-orange);
}

.copilot-pill:hover .copilot-sparkle {
  color: var(--office-white);
}

/* --------------------------------------------------------------------------
   2. LE RUBAN WORD (The Ribbon)
   -------------------------------------------------------------------------- */

#word-ribbon {
  background: var(--office-white);
  border-bottom: 1px solid var(--office-gray-30);
  user-select: none;
  z-index: 30;
}

/* Barre des onglets (Tabs) */
.ribbon-tabs-bar {
  display: flex;
  align-items: center;
  height: var(--ribbon-tabs-height);
  padding: 0 10px;
  background: var(--office-white);
  border-bottom: 1px solid var(--office-gray-20);
}

.ribbon-tab-btn {
  font-family: var(--font-office-ui);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--office-gray-70);
  background: transparent;
  border: none;
  padding: 0 12px;
  height: 100%;
  cursor: pointer;
  position: relative;
  transition: background 0.1s ease, color 0.1s ease;
}

.ribbon-tab-btn:hover {
  background: var(--office-gray-20);
  color: var(--word-orange);
}

.ribbon-tab-btn.active {
  font-weight: 600;
  color: var(--word-orange-dark);
}

.ribbon-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 6px;
  right: 6px;
  height: 3px;
  background: var(--word-orange);
  border-radius: 3px 3px 0 0;
}

/* Onglet spécial FICHIER en Orange Word */
.ribbon-tab-btn.file-tab {
  background: var(--word-orange);
  color: var(--office-white);
  font-weight: 600;
  border-radius: 4px 4px 0 0;
  margin-right: 4px;
}

.ribbon-tab-btn.file-tab:hover {
  background: var(--word-orange-dark);
  color: var(--office-white);
}

.ribbon-tab-btn.file-tab.active::after {
  display: none;
}

.ribbon-tab-btn.copilot-tab {
  color: var(--word-orange);
  font-weight: 600;
}

/* Panneaux d'outils du Ruban */
.ribbon-content-bar {
  height: var(--ribbon-content-height);
  padding: 6px 12px;
  background: var(--office-white);
}

.ribbon-panel {
  display: none;
  height: 100%;
  align-items: stretch;
  gap: 4px;
}

.ribbon-panel.active {
  display: flex;
}

/* Groupes d'outils dans le Ruban */
.ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 6px 2px;
  border-right: 1px solid var(--office-gray-30);
  position: relative;
}

.ribbon-group:last-child {
  border-right: none;
}

.group-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.group-label {
  font-size: 9.5px;
  color: var(--office-gray-50);
  text-align: center;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Outils verticaux & horizontaux */
.tool-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.stacked-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.large-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  height: 64px;
  min-width: 52px;
  cursor: pointer;
  color: var(--office-gray-80);
  transition: all 0.1s ease;
}

.large-tool-btn:hover {
  background: var(--office-gray-20);
  border-color: var(--office-gray-30);
}

.large-tool-btn.active-view {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange-border);
  color: var(--word-orange-dark);
}

.large-tool-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.large-tool-label {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
}

.small-tool-btn {
  font-family: var(--font-office-ui);
  font-size: 11px;
  color: var(--office-gray-80);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.small-tool-btn:hover {
  background: var(--office-gray-20);
  border-color: var(--office-gray-30);
}

.icon-tool-btn {
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--office-gray-80);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-office-ui);
}

.icon-tool-btn:hover {
  background: var(--office-gray-20);
  border-color: var(--office-gray-30);
  color: var(--word-orange);
}

.icon-tool-btn.active {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange-border);
  color: var(--word-orange-dark);
}

/* Sélecteurs déroulants Word */
.word-select {
  font-family: var(--font-office-ui);
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--office-gray-30);
  border-radius: 3px;
  background: var(--office-white);
  color: var(--office-gray-80);
  outline: none;
}

.word-select:hover, .word-select:focus {
  border-color: var(--word-orange);
}

.font-name-select {
  width: 140px;
}

.font-size-select {
  width: 52px;
}

/* Sélecteur de couleur Word avec barre en dessous */
.color-tool-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid transparent;
}

.color-tool-btn:hover {
  background: var(--office-gray-20);
}

.color-letter {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.color-bar {
  width: 14px;
  height: 3px;
  border-radius: 1px;
  background: var(--word-orange);
  margin-top: 1px;
}

#font-color-picker {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Palette Surlignage Word */
.dropdown-wrapper {
  position: relative;
}

.dropdown-menu-palette {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--office-white);
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  z-index: 100;
}

.hl-box {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.hl-yellow { background: #fef08a; }
.hl-orange { background: #ffedd5; }
.hl-green  { background: #bbf7d0; }
.hl-pink   { background: #fbcfe8; }
.hl-blue   { background: #bae6fd; }

.hl-none-btn {
  grid-column: span 5;
  font-size: 10.5px;
  border: none;
  background: var(--office-gray-20);
  padding: 3px;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 2px;
}

.hl-none-btn:hover {
  background: var(--word-orange-subtle);
  color: var(--word-orange-dark);
}

/* Galerie de Styles Word (Style cards) */
.styles-group {
  flex: 1;
  max-width: 480px;
}

.styles-gallery {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 0;
}

.style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  padding: 4px 8px;
  min-width: 68px;
  height: 60px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.style-card:hover {
  background: var(--office-white);
  border-color: var(--word-orange);
}

.style-card.active {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange);
  box-shadow: 0 0 0 1px var(--word-orange);
}

.style-preview {
  font-size: 13px;
  line-height: 1;
  margin-bottom: 4px;
}

.normal-preview { font-family: Calibri, sans-serif; }
.h1-preview { font-size: 15px; font-weight: bold; color: var(--word-orange-dark); }
.h2-preview { font-size: 13px; font-weight: bold; color: var(--word-orange); }
.h3-preview { font-size: 12px; font-weight: bold; }
.quote-preview { font-style: italic; color: var(--office-gray-60); }
.code-preview { font-family: monospace; font-size: 11px; }

.style-name {
  font-size: 10px;
  color: var(--office-gray-60);
}

/* Contrôles Copilot dans le ruban */
.copilot-controls {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}

.copilot-input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

#copilot-prompt-input {
  flex: 1;
  font-family: var(--font-office-ui);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  outline: none;
}

#copilot-prompt-input:focus {
  border-color: var(--word-orange);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

.copilot-submit-btn {
  background: var(--word-orange);
  color: var(--office-white);
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}

.copilot-submit-btn:hover {
  background: var(--word-orange-dark);
}

.copilot-quick-prompts {
  display: flex;
  gap: 6px;
}

.ai-chip {
  font-size: 10.5px;
  background: var(--office-gray-20);
  border: 1px solid var(--office-gray-30);
  border-radius: 10px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--office-gray-70);
}

.ai-chip:hover {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange-border);
  color: var(--word-orange-dark);
}

/* --------------------------------------------------------------------------
   3. CORPS DE L'APPLICATION (Volet Navigation + Zone Document)
   -------------------------------------------------------------------------- */

#word-body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Volet de navigation Word (gauche) */
#word-navpane {
  width: var(--navpane-width);
  min-width: var(--navpane-width);
  background: var(--office-white);
  border-right: 1px solid var(--office-gray-30);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

#word-navpane.collapsed {
  display: none;
}

.navpane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--office-gray-20);
}

.navpane-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--office-gray-80);
}

.navpane-close {
  background: transparent;
  border: none;
  font-size: 13px;
  color: var(--office-gray-50);
  cursor: pointer;
}

.navpane-close:hover {
  color: var(--word-orange);
}

.navpane-tabs {
  display: flex;
  border-bottom: 1px solid var(--office-gray-30);
  background: var(--office-gray-10);
}

.navpane-tab {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 11.5px;
  font-weight: 500;
  padding: 7px 0;
  cursor: pointer;
  color: var(--office-gray-60);
  text-align: center;
}

.navpane-tab:hover {
  color: var(--word-orange);
}

.navpane-tab.active {
  background: var(--office-white);
  color: var(--word-orange-dark);
  font-weight: 600;
  border-bottom: 2px solid var(--word-orange);
}

.navpane-section {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.navpane-section.active {
  display: flex;
  flex-direction: column;
}

.navpane-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.nav-btn-primary {
  background: var(--word-orange);
  color: var(--office-white);
  border: none;
  border-radius: 4px;
  padding: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn-primary:hover {
  background: var(--word-orange-dark);
}

.nav-btn-secondary {
  background: var(--office-gray-10);
  color: var(--office-gray-80);
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  padding: 6px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.nav-btn-secondary:hover {
  background: var(--office-gray-20);
}

.word-doc-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.word-doc-list li {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 3px;
  border-left: 3px solid transparent;
  background: transparent;
  transition: all 0.1s ease;
}

.word-doc-list li:hover {
  background: var(--office-gray-20);
}

.word-doc-list li.active {
  background: var(--word-orange-subtle);
  border-left-color: var(--word-orange);
}

.doc-name-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--office-gray-80);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta-label {
  font-size: 10.5px;
  color: var(--office-gray-50);
}

/* Recherche dans le volet */
.nav-search-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-with-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  padding: 5px 8px;
}

.input-with-icon input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  width: 100%;
}

.nav-search-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.search-info {
  font-size: 11px;
  color: var(--office-gray-50);
  text-align: center;
  margin-top: 4px;
}

/* Plan du document (Titres H1/H2/H3) */
.outline-tree {
  list-style: none;
}

.outline-tree li {
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  color: var(--office-gray-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outline-tree li:hover {
  background: var(--office-gray-20);
  color: var(--word-orange);
}

.outline-h1 { font-weight: 600; padding-left: 4px; }
.outline-h2 { padding-left: 14px; font-size: 11.5px; }
.outline-h3 { padding-left: 24px; font-size: 11px; color: var(--office-gray-60); }
.empty-outline { font-style: italic; color: var(--office-gray-50); text-align: center; margin-top: 20px; }

/* --------------------------------------------------------------------------
   RÈGLE GRADUÉE WORD & ZONE DE TRAVAIL (Workspace)
   -------------------------------------------------------------------------- */

#word-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  background: var(--office-gray-bg);
}

/* Règle graduée horizontale */
#word-ruler {
  height: var(--ruler-height);
  background: var(--office-gray-20);
  border-bottom: 1px solid var(--office-gray-30);
  display: flex;
  justify-content: center;
  user-select: none;
}

.ruler-body {
  width: 794px; /* Même largeur que la page A4 */
  height: 100%;
  background: var(--office-white);
  border-left: 1px solid var(--office-gray-30);
  border-right: 1px solid var(--office-gray-30);
  position: relative;
  display: flex;
  align-items: flex-end;
}

.ruler-numbers {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 60px 2px; /* Marges correspondantes */
  font-size: 9px;
  color: var(--office-gray-50);
}

.ruler-indent-left {
  position: absolute;
  left: 60px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--word-orange);
}

.ruler-indent-right {
  position: absolute;
  right: 60px;
  bottom: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--word-orange);
}

/* Bureau avec la feuille de papier */
#word-desk {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 30px 20px 60px;
  display: flex;
  justify-content: center;
}

/* Conteneur de page avec Zoom */
#page-wrapper {
  background: var(--office-white);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  position: relative;
  transform-origin: top center;
  transform: scale(var(--zoom-factor));
  transition: transform 0.1s ease-out;
}

/* Format A4 Portrait */
#page-wrapper.a4-portrait {
  width: 794px;
  min-height: 1123px;
  padding: 60px 64px;
}

/* Format A4 Paysage */
#page-wrapper.a4-landscape {
  width: 1123px;
  min-height: 794px;
  padding: 50px 64px;
}

/* Marges personnalisées */
#page-wrapper.margins-narrow { padding: 30px 32px; }
#page-wrapper.margins-wide { padding: 80px 96px; }

/* En-tête et pied de page discrets */
.page-header-hint, .page-footer-hint {
  font-size: 11px;
  color: var(--office-gray-40);
  user-select: none;
  border-bottom: 1px dashed transparent;
  padding-bottom: 4px;
  margin-bottom: 12px;
}

.page-footer-hint {
  margin-top: auto;
  padding-top: 12px;
  margin-bottom: 0;
  border-top: 1px dashed transparent;
  display: flex;
  justify-content: flex-end;
}

.page-header-hint:hover, .page-footer-hint:hover {
  border-color: var(--office-gray-30);
  color: var(--word-orange);
}

/* L'Éditeur proprement dit (Feuille Word) */
#editor {
  flex: 1;
  outline: none;
  font-family: var(--font-word-body);
  font-size: 11pt;
  line-height: 1.15;
  color: var(--office-gray-80);
}

#editor:empty::before {
  content: attr(data-placeholder);
  color: var(--office-gray-50);
  pointer-events: none;
}

/* Éléments Word dans l'éditeur */
#editor p {
  margin-bottom: 0.5em;
}

#editor h1 {
  font-size: 18pt;
  font-weight: 700;
  color: var(--word-orange-dark);
  margin: 0.8em 0 0.3em;
  line-height: 1.2;
}

#editor h2 {
  font-size: 14pt;
  font-weight: 700;
  color: var(--word-orange);
  margin: 0.7em 0 0.3em;
}

#editor h3 {
  font-size: 12pt;
  font-weight: 600;
  color: var(--office-gray-80);
  margin: 0.6em 0 0.25em;
}

#editor blockquote {
  margin: 0.8em 0;
  padding: 6px 18px;
  border-left: 3px solid var(--word-orange);
  background: var(--word-orange-subtle);
  color: var(--office-gray-70);
  font-style: italic;
}

#editor pre {
  margin: 0.8em 0;
  padding: 10px 14px;
  background: var(--office-gray-20);
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 10pt;
  overflow-x: auto;
}

#editor hr {
  border: none;
  height: 1px;
  background: var(--office-gray-30);
  margin: 1.2em 0;
}

#editor hr.page-break {
  height: 2px;
  background: var(--word-orange-border);
  border-top: 1px dashed var(--word-orange);
  margin: 2em 0;
  position: relative;
}

#editor hr.page-break::after {
  content: "--- Saut de page ---";
  position: absolute;
  right: 10px;
  top: -8px;
  font-size: 10px;
  color: var(--word-orange);
  background: var(--office-white);
  padding: 0 4px;
}

/* Tableaux Word */
#editor table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  border: 1px solid var(--office-gray-40);
}

#editor th, #editor td {
  border: 1px solid var(--office-gray-30);
  padding: 6px 10px;
  text-align: left;
}

#editor th {
  background: var(--word-orange-subtle);
  color: var(--word-orange-dark);
  font-weight: 600;
}

/* Listes à cocher interactives Word */
#editor ul.checklist {
  list-style: none;
  padding-left: 0.2em;
}

#editor li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0.3em;
}

#editor li.task-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--word-orange);
  border-radius: 3px;
  margin-top: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#editor li.task-item input[type="checkbox"]:checked {
  background: var(--word-orange);
}

#editor li.task-item input[type="checkbox"]:checked::after {
  content: "✓";
  color: var(--office-white);
  font-size: 11px;
  font-weight: bold;
}

#editor li.task-item[data-checked="true"] > span.task-text {
  text-decoration: line-through;
  color: var(--office-gray-50);
}

/* --------------------------------------------------------------------------
   4. BARRE D'ÉTAT WORD (Status Bar)
   -------------------------------------------------------------------------- */

#word-statusbar {
  height: var(--statusbar-height);
  background: var(--office-white);
  border-top: 1px solid var(--office-gray-30);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  color: var(--office-gray-60);
  user-select: none;
  z-index: 30;
}

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

.status-item {
  display: inline-flex;
  align-items: center;
}

.status-button {
  background: transparent;
  border: none;
  color: var(--office-gray-60);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
}

.status-button:hover {
  background: var(--office-gray-20);
  color: var(--word-orange);
}

.view-shortcuts {
  display: flex;
  align-items: center;
  gap: 2px;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 2px;
}

.view-btn:hover {
  background: var(--office-gray-20);
}

.view-btn.active {
  background: var(--word-orange-subtle);
}

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

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--office-gray-60);
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  padding: 0 2px;
}

.zoom-btn:hover {
  color: var(--word-orange);
}

#zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: var(--office-gray-30);
  border-radius: 2px;
  outline: none;
}

#zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--word-orange);
  cursor: pointer;
}

.zoom-text {
  font-size: 11px;
  min-width: 34px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   5. MENU FICHIER WORD (Backstage View)
   -------------------------------------------------------------------------- */

.backstage-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--office-white);
  z-index: 1000;
  display: flex;
  animation: fadeIn 0.1s ease-out;
}

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

.backstage-sidebar {
  width: 200px;
  background: var(--word-orange);
  color: var(--office-white);
  display: flex;
  flex-direction: column;
  padding: 14px 0;
}

.backstage-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--office-white);
  font-size: 18px;
  cursor: pointer;
  margin-left: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.backstage-back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.backstage-menu {
  list-style: none;
  flex: 1;
}

.backstage-item {
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.backstage-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

.backstage-item.active {
  background: var(--office-white);
  color: var(--word-orange);
  font-weight: 600;
}

.backstage-footer {
  padding: 0 20px;
  font-size: 12px;
  opacity: 0.8;
}

.backstage-content {
  flex: 1;
  padding: 40px 50px;
  overflow-y: auto;
  background: var(--office-white);
}

.backstage-panel {
  display: none;
  max-width: 800px;
}

.backstage-panel.active {
  display: block;
}

.backstage-panel h2 {
  font-size: 24px;
  font-weight: 400;
  color: var(--office-gray-80);
  margin-bottom: 16px;
}

.info-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

.info-card {
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 6px;
  padding: 20px;
}

.info-card h3 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--word-orange-dark);
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

/* Modèles vierge / rapport */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.template-card:hover {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange-border);
}

.template-thumbnail {
  width: 140px;
  height: 180px;
  background: var(--office-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--office-gray-30);
  border-radius: 3px;
  margin-bottom: 8px;
  padding: 12px;
}

.t-line { height: 4px; background: var(--office-gray-30); margin-bottom: 8px; border-radius: 2px; }
.t-title { background: var(--word-orange); height: 8px; width: 70%; }
.t-check { color: var(--word-orange); font-weight: bold; margin-bottom: 6px; }

/* Grille d'exportation */
.export-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.export-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 6px;
  padding: 16px;
}

.export-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--office-white);
}

.docx-color { background: var(--word-orange); }
.pdf-color  { background: #dc2626; }
.txt-color  { background: #475569; }
.html-color { background: #0284c7; }

.export-desc {
  flex: 1;
}

.export-desc strong { font-size: 14px; display: block; margin-bottom: 2px; }
.export-desc p { font-size: 11.5px; color: var(--office-gray-60); margin: 0; }

/* Convertisseur dans Backstage */
.convert-widget-box {
  background: var(--office-gray-10);
  border: 1px dashed var(--word-orange);
  border-radius: 8px;
  padding: 24px;
  margin-top: 20px;
}

.convert-input-row, .convert-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

/* Boutons Word */
.word-btn {
  font-family: var(--font-office-ui);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--office-gray-30);
  background: var(--office-white);
  color: var(--office-gray-80);
  cursor: pointer;
}

.word-btn:hover {
  background: var(--office-gray-20);
}

.word-btn-primary {
  background: var(--word-orange);
  border-color: var(--word-orange);
  color: var(--office-white);
  font-weight: 600;
}

.word-btn-primary:hover {
  background: var(--word-orange-dark);
}

.word-btn-danger {
  color: #dc2626;
  border-color: #fecaca;
  margin-top: 8px;
}

.word-btn-danger:hover {
  background: #fef2f2;
}

/* Boîte de dialogue Statistiques Word (Modal) */
.word-modal {
  border: 1px solid var(--office-gray-30);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 0;
  width: 320px;
  margin: auto;
}

.word-modal::backdrop {
  background: rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--office-gray-20);
  border-bottom: 1px solid var(--office-gray-30);
  font-weight: 600;
  font-size: 13px;
}

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.modal-body {
  padding: 14px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.modal-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--office-gray-20);
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   6. PANNEAUX COMPLETS : OUVRIR, ENREGISTRER & IMPRIMER
   -------------------------------------------------------------------------- */

/* Section Ouvrir */
.backstage-open-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  margin-top: 20px;
}

.open-left-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.large-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.btn-large-icon {
  font-size: 28px;
}

.btn-large-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.btn-large-text p {
  font-size: 11px;
  opacity: 0.9;
  margin: 0;
  font-weight: normal;
}

.search-open-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 6px;
  padding: 6px 10px;
}

.search-open-wrap input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  width: 100%;
}

.section-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--office-gray-70);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.backstage-doc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
}

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

.backstage-doc-item:hover {
  background: var(--word-orange-subtle);
  border-color: var(--word-orange-border);
  transform: translateX(3px);
}

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

.doc-fmt-tag {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--word-orange);
}

.doc-title-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--office-gray-80);
}

.doc-meta-text {
  font-size: 11px;
  color: var(--office-gray-50);
}

/* Section Enregistrer */
.save-status-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.save-icon-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

.save-status-box strong {
  font-size: 14.5px;
  color: #065f46;
  display: block;
}

.save-status-box p {
  font-size: 12px;
  color: #047857;
  margin: 0;
}

.save-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.save-panel-card {
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 8px;
  padding: 20px;
}

.save-panel-card h3 {
  font-size: 15px;
  color: var(--word-orange-dark);
  margin-bottom: 12px;
}

.input-inline-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.word-input {
  flex: 1;
  font-family: var(--font-office-ui);
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  outline: none;
}

.word-input:focus {
  border-color: var(--word-orange);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
}

.quick-save-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.path-display {
  font-size: 13px;
  margin-bottom: 12px;
}

.path-display code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.save-features-list {
  list-style: none;
  font-size: 12px;
  color: var(--office-gray-60);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Section Imprimer */
.backstage-print-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  margin-top: 20px;
}

.print-settings-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.print-big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

.print-big-icon {
  font-size: 20px;
}

.print-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--office-gray-10);
  border: 1px solid var(--office-gray-30);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}

.word-input-num {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--office-gray-30);
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.print-settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.print-setting-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--office-gray-70);
}

.print-preview-col {
  display: flex;
  flex-direction: column;
}

.print-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--office-gray-70);
}

.print-preview-desk {
  background: var(--office-gray-20);
  border: 1px solid var(--office-gray-30);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  max-height: 520px;
  overflow-y: auto;
}

.preview-a4-sheet {
  width: 420px;
  min-height: 594px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 30px;
  font-family: var(--font-word-body);
  font-size: 8pt;
  line-height: 1.2;
  color: #201f1e;
  overflow: hidden;
}

.preview-a4-sheet h1 { font-size: 12pt; margin-bottom: 4px; color: var(--word-orange-dark); }
.preview-a4-sheet h2 { font-size: 10pt; margin-bottom: 3px; color: var(--word-orange); }
.preview-a4-sheet p  { margin-bottom: 4px; }
.preview-a4-sheet table { font-size: 7pt; width: 100%; border-collapse: collapse; margin: 4px 0; }
.preview-a4-sheet td, .preview-a4-sheet th { border: 1px solid #ccc; padding: 2px 4px; }

/* --------------------------------------------------------------------------
   7. NOUVELLES FONCTIONNALITÉS
   -------------------------------------------------------------------------- */

/* === Pagination réelle : séparateurs de pages === */
.page-gap {
  height: 26px;
  background: var(--office-desk, #edebe9);
  box-shadow:
    inset 0 3px 5px rgba(0,0,0,0.10),
    inset 0 -3px 5px rgba(0,0,0,0.10);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.page-gap-label {
  font-size: 9px;
  color: var(--office-gray-40);
  background: var(--office-desk, #edebe9);
  padding: 0 8px;
  letter-spacing: 0.05em;
}

/* === Mode Focus === */
body.focus-mode #word-ribbon,
body.focus-mode #word-navpane,
body.focus-mode #word-ruler,
body.focus-mode #word-titlebar .titlebar-right,
body.focus-mode #comments-rail {
  display: none;
}

body.focus-mode #word-desk {
  background: #f7f4ef;
}

.focus-dimmed {
  opacity: 0.30;
  transition: opacity 0.25s ease;
}

.focus-active {
  opacity: 1;
  transition: opacity 0.25s ease;
}

/* === Dictée : bouton en enregistrement === */
#btn-dictate.recording {
  background: #fee2e2 !important;
  border: 1px solid #dc2626 !important;
  animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
}

/* === Objectif de mots & Pomodoro (barre d'état) === */
.status-button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.status-button:hover {
  color: var(--word-orange);
}

#status-word-goal.goal-reached {
  color: #16a34a;
  font-weight: 700;
}

#status-pomodoro.pomo-running {
  color: var(--word-orange);
  font-weight: 700;
}

/* === En-tête / pied de page éditables === */
.hf-editable {
  min-height: 1.2em;
  outline: none;
  border-radius: 3px;
  padding: 2px 4px;
}

.hf-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--office-gray-40);
  pointer-events: none;
}

.hf-editable:hover, .hf-editable:focus {
  background: var(--word-orange-subtle, #fff7ed);
}

.page-footer-hint {
  align-items: center;
  gap: 10px;
}

.page-footer-hint #doc-footer {
  flex: 1;
}

/* === Commentaires de marge === */
.comment-anchor {
  background: linear-gradient(to bottom, transparent 62%, #ffd8a8 62%);
  border-bottom: 2px solid var(--word-orange);
  cursor: pointer;
}

.comment-flash {
  animation: cflash 1.2s ease;
}

@keyframes cflash {
  0%, 60% { background: #fed7aa; }
  100% { background: inherit; }
}

#comments-rail {
  position: relative;
  width: 230px;
  flex-shrink: 0;
  margin-left: 18px;
  align-self: flex-start;
  position: sticky;
  top: 20px;
}

.comments-rail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--office-gray-80);
  padding: 6px 8px;
  border-bottom: 1px solid var(--office-gray-30);
  margin-bottom: 6px;
}

#comments-list {
  position: relative;
  min-height: 200px;
}

.comment-card {
  position: absolute;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--office-gray-30);
  border-left: 3px solid var(--word-orange);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  cursor: pointer;
}

.comment-card.resolved {
  opacity: 0.45;
  border-left-color: var(--office-gray-40);
}

.comment-meta {
  font-size: 10px;
  color: var(--office-gray-40);
  margin-bottom: 3px;
}

.comment-text {
  color: var(--office-gray-80);
  line-height: 1.35;
  word-break: break-word;
}

.comment-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.comment-btn {
  border: none;
  background: var(--word-orange-subtle, #fff7ed);
  color: var(--word-orange-dark);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}

/* === Table des matières === */
.doc-toc {
  border: 1px solid var(--office-gray-30);
  border-radius: 8px;
  background: #fafaf8;
  padding: 14px 22px;
  margin: 1em 0;
}

.doc-toc .toc-title {
  font-weight: 700;
  font-size: 13pt;
  color: var(--word-orange-dark);
  margin-bottom: 8px;
}

.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 3px 0; }
.doc-toc .toc-h2 { padding-left: 20px; font-size: 0.95em; }
.doc-toc .toc-h3 { padding-left: 40px; font-size: 0.9em; color: var(--office-gray-60); }
.doc-toc a { color: var(--office-gray-80); text-decoration: none; }
.doc-toc a:hover { color: var(--word-orange); text-decoration: underline; }

/* === Suivi des modifications === */
#editor ins.tc-ins, #editor ins {
  background: #dcfce7;
  color: #166534;
  text-decoration: underline;
  text-decoration-color: #16a34a;
}

#editor del.tc-del, #editor del {
  background: #fee2e2;
  color: #b91c1c;
  text-decoration: line-through;
}

#btn-track-changes.active-view {
  background: var(--word-orange-subtle, #fff7ed);
  outline: 2px solid var(--word-orange);
}

/* === Cellules de tableau : redimensionnement === */
#editor td, #editor th {
  position: relative;
}

/* === Dossiers & tags dans la liste === */
.doc-folder-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--office-gray-50);
  padding: 10px 10px 4px;
  cursor: default;
  background: none !important;
}

.doc-tag {
  display: inline-block;
  background: var(--word-orange-subtle, #fff7ed);
  color: var(--word-orange-dark);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 3px;
}

.doc-tags-row { display: block; margin-top: 2px; }

/* === Menu contextuel documents === */
.context-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--office-gray-30);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 210px;
}

.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--office-gray-80);
}

.ctx-item:hover { background: var(--word-orange-subtle, #fff7ed); }
.ctx-danger { color: #dc2626; }
.ctx-danger:hover { background: #fee2e2; }

/* === Zone de dépôt === */
#drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(234, 88, 12, 0.12);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-box {
  border: 3px dashed var(--word-orange);
  border-radius: 16px;
  background: #fff;
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.drop-icon { font-size: 44px; color: var(--word-orange); }
.drop-box p { font-size: 16px; font-weight: 700; margin: 8px 0 4px; }
.drop-box span { font-size: 11px; color: var(--office-gray-50); }

/* === Recherche globale === */
.nav-search-global {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--office-gray-30);
}

.global-search-list { list-style: none; margin: 8px 0 0; padding: 0; }

.global-search-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.global-search-list li:hover { background: var(--word-orange-subtle, #fff7ed); }
.gs-name { font-weight: 600; color: var(--office-gray-80); }
.gs-meta { font-size: 10px; color: var(--office-gray-50); }
.gs-snippet { font-size: 11px; color: var(--office-gray-60); font-style: italic; margin-top: 2px; }

/* === Corbeille & versions === */
.corbeille-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trash-tag { background: #fee2e2 !important; }
.trash-actions { display: flex; gap: 8px; }

.empty-state-li {
  padding: 20px;
  text-align: center;
  color: var(--office-gray-50);
  font-style: italic;
  list-style: none;
}

/* === Lettre US === */
#page-wrapper[data-size="letter"].a4-portrait { width: 816px; min-height: 1056px; }
#page-wrapper[data-size="letter"].a4-landscape { width: 1056px; min-height: 816px; }

/* === Liens internes entre documents [[wiki]] === */
.doc-link {
  color: var(--word-orange);
  text-decoration: none;
  border-bottom: 1px dashed var(--word-orange);
  cursor: pointer;
  background: var(--word-orange-subtle, #fff7ed);
  padding: 0 3px;
  border-radius: 3px;
}

.doc-link:hover {
  background: #fed7aa;
}

.doc-lock-icon { margin-right: 4px; font-size: 11px; }

/* Sécurité : l'attribut hidden doit TOUJOURS gagner sur les display flex/block */
[hidden] {
  display: none !important;
}

/* === Présentation (diaporama plein écran) === */
#presentation-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #161513;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#presentation-slide {
  background: #fff;
  width: min(1100px, 88vw);
  height: min(680px, 82vh);
  overflow: hidden auto;
  border-radius: 10px;
  padding: 60px 80px;
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 16pt;
  line-height: 1.5;
  color: #201f1e;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

#presentation-slide h1 { color: var(--word-orange-dark); font-size: 30pt; margin: 0 0 0.4em; }
#presentation-slide h2 { color: var(--word-orange); font-size: 22pt; margin: 0.4em 0 0.3em; }
#presentation-slide h3 { font-size: 18pt; }
#presentation-slide img { max-width: 100%; max-height: 55vh; }
#presentation-slide table { border-collapse: collapse; width: 100%; font-size: 14pt; }
#presentation-slide td, #presentation-slide th { border: 1px solid #d2d0ce; padding: 8px 12px; }
#presentation-slide blockquote { border-left: 4px solid var(--word-orange); background: #fff7ed; padding: 10px 20px; margin: 0.8em 0; font-style: italic; }
#presentation-slide hr { border: none; height: 1px; background: #d2d0ce; margin: 1.5em 0; }
#presentation-slide .checklist { list-style: none; padding-left: 4px; }
#presentation-slide .task-item input { transform: scale(1.4); margin-right: 10px; }

.presentation-controls {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pres-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
}

.pres-btn:hover:not(:disabled) { background: var(--word-orange); border-color: var(--word-orange); }
.pres-btn:disabled { opacity: 0.35; cursor: default; }
.pres-exit { margin-left: 18px; }
#pres-counter { color: rgba(255,255,255,0.75); font-size: 13px; min-width: 55px; text-align: center; }

/* === Modèles personnalisés === */
.custom-templates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--office-gray-30);
}

.custom-templates-header h3 { margin: 0; font-size: 14px; color: var(--office-gray-80); }

.custom-template-card { position: relative; }

.custom-thumb {
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, #fff7ed, #ffedd5) !important;
}

.tpl-delete {
  position: absolute;
  top: 6px; right: 6px;
  border: none; background: rgba(0,0,0,0.06);
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 10px; cursor: pointer; color: #666;
}

.tpl-delete:hover { background: #dc2626; color: #fff; }

/* === Modal mot de passe === */
#password-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

#password-dialog::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }

.word-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--office-gray-30);
}

/* === Écran d'accueil (Start Screen) === */
#welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: linear-gradient(160deg, #fff 60%, #fff7ed 100%);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.welcome-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 48px 64px 24px;
}

.welcome-brand { display: flex; align-items: center; gap: 18px; }

.welcome-badge {
  width: 56px; height: 56px;
  font-size: 28px;
  border-radius: 14px;
}

.welcome-brand h1 {
  margin: 0;
  font-size: 26px;
  color: var(--office-gray-80);
  font-weight: 700;
}

.welcome-brand p { margin: 2px 0 0; color: var(--word-orange); font-size: 13px; }

.welcome-close {
  border: none;
  background: var(--office-gray-20);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
  color: var(--office-gray-60);
}

.welcome-close:hover { background: #fee2e2; color: #dc2626; }

.welcome-body {
  display: flex;
  gap: 56px;
  padding: 10px 64px 48px;
  flex: 1;
}

.welcome-left { width: 300px; flex-shrink: 0; }
.welcome-right { flex: 1; }

.welcome-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--office-gray-50);
  margin-bottom: 12px;
}

.welcome-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--office-gray-30);
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.welcome-action:hover {
  border-color: var(--word-orange);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.12);
  transform: translateY(-1px);
}

.welcome-action strong { font-size: 13px; color: var(--office-gray-80); }
.welcome-action p { margin: 2px 0 0; font-size: 11px; color: var(--office-gray-50); }

.wa-icon {
  font-size: 24px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--word-orange-subtle, #fff7ed);
  border-radius: 10px;
  flex-shrink: 0;
}

.welcome-footer-check {
  margin-top: 18px;
  font-size: 12px;
  color: var(--office-gray-60);
}

.welcome-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.welcome-doc-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--office-gray-30);
  border-radius: 10px;
  padding: 18px 14px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s;
  min-height: 110px;
}

.welcome-doc-card:hover {
  border-color: var(--word-orange);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.14);
  transform: translateY(-2px);
}

.wd-fmt {
  font-size: 9px;
  font-weight: 700;
  color: var(--word-orange);
  background: var(--word-orange-subtle, #fff7ed);
  padding: 2px 7px;
  border-radius: 5px;
  align-self: flex-start;
}

.wd-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--office-gray-80);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wd-date { font-size: 10px; color: var(--office-gray-50); margin-top: auto; }

.wd-lock { position: absolute; top: 10px; right: 10px; font-size: 12px; }

/* === Configuration IA (onglet Copilot) === */
.copilot-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--office-gray-30);
}

.ai-status-dot {
  font-size: 11px;
  font-weight: 600;
  color: var(--office-gray-50);
  white-space: nowrap;
}

.ai-status-dot.ai-on { color: #16a34a; }

.ai-key-input { width: 180px; }

/* --------------------------------------------------------------------------
   8. STYLES D'IMPRESSION PRO (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body, html {
    background: #ffffff !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* Masquer tous les composants de l'interface logicielle */
  #word-titlebar,
  #word-ribbon,
  #word-navpane,
  #word-ruler,
  #word-statusbar,
  #word-backstage,
  #comments-rail,
  #doc-context-menu,
  #drop-overlay,
  .page-gap,
  .page-number-display {
    display: none !important;
  }

  /* En mode focus, tout le contenu s'imprime normalement */
  .focus-dimmed, .focus-active {
    opacity: 1 !important;
  }

  #word-body, #word-workspace, #word-desk {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  #page-wrapper {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: auto !important;
    transform: none !important;
  }

  #editor {
    font-size: 12pt !important;
    color: #000000 !important;
  }

  /* Sauts de page explicites respectés à l'impression */
  #editor hr.page-break {
    page-break-after: always;
    break-after: page;
    visibility: hidden;
    height: 0;
    margin: 0;
  }

  /* En-tête/pied de page imprimés en gris discret */
  #doc-header, #doc-footer {
    font-size: 9pt;
    color: #666 !important;
  }

  @page {
    size: A4;
    margin: 20mm;
  }
}


/* =============================================================================
   ONGLETS DU MENU D'ACCUEIL (Documents | IA | Sécurité)
   ============================================================================= */

.welcome-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 2px solid #f0e6dc;
  padding-bottom: 0;
}

.welcome-tab {
  border: none;
  background: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #8a7f73;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s;
}

.welcome-tab:hover {
  color: #ea580c;
  background: #fff5ec;
}

.welcome-tab.active {
  color: #ea580c;
  border-bottom-color: #ea580c;
}

.welcome-pane {
  display: none;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  padding-right: 6px;
}

.welcome-pane.active {
  display: block;
}

/* --- Fournisseurs IA --- */

.ai-provider-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}

.ai-provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1.5px solid #f0e6dc;
  border-radius: 10px;
}

.ai-provider-row.active {
  border-color: #ea580c;
  background: #fff8f2;
  box-shadow: 0 2px 8px rgba(234, 88, 12, .12);
}

.ai-prov-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-prov-info strong {
  font-size: 13.5px;
  color: #3f3a35;
}

.ai-prov-meta {
  font-size: 11px;
  color: #a39a90;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-prov-active-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ea580c, #dc2626);
  border-radius: 999px;
  padding: 1px 8px;
  width: fit-content;
}

.ai-prov-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ai-prov-actions .word-btn {
  font-size: 11px;
  padding: 4px 10px;
}

.ai-connect-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-field {
  padding: 8px 10px;
  border: 1.5px solid #e7ddd2;
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.ai-field:focus {
  outline: none;
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .12);
}

.ai-connect-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-connect-msg {
  font-size: 12px;
  color: #dc2626;
}

.ai-hint {
  font-size: 11px;
  color: #a39a90;
  margin-top: 12px;
  line-height: 1.5;
}

/* --- Sécurité --- */

.security-doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sec-subtitle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #a39a90;
  margin: 6px 0 2px;
}

.security-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1.5px solid #f0e6dc;
  border-radius: 10px;
}

.security-doc-row .word-btn {
  font-size: 11px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.sec-doc-icon { font-size: 15px; }

.sec-doc-name {
  flex: 1;
  font-size: 13px;
  color: #3f3a35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sec-doc-state {
  font-size: 11px;
  color: #a39a90;
  flex-shrink: 0;
}

.security-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.security-file-btn {
  cursor: pointer;
  flex-shrink: 0;
}

.security-file-name {
  flex: 1;
  font-size: 12px;
  color: #8a7f73;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 80px;
}

/* --- Imprimante : ligne de statut --- */

.printer-status-line {
  font-size: 11px;
  color: #10b981;
  margin-top: 4px;
  min-height: 14px;
}

.printer-status-line.warn {
  color: #dc2626;
}

/* Lien Accueil dans le menu Fichier */

.backstage-home {
  color: #fdba74;
  font-weight: 700;
}

.backstage-home:hover,
.backstage-home.active {
  color: #fff;
}


/* ═══ Authentification multi-comptes ═══ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 40px 36px;
  width: 340px; max-width: 90vw; text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  display: flex; flex-direction: column; gap: 12px;
}
.auth-brand { display: flex; justify-content: center; margin-bottom: 4px; }
.auth-brand .word-icon-badge { width: 48px; height: 48px; font-size: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.auth-title { font-size: 20px; margin: 0; color: #1e293b; }
.auth-subtitle { font-size: 13px; color: #64748b; margin: 0 0 8px; }
.auth-input {
  padding: 11px 14px; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 15px; outline: none; width: 100%; box-sizing: border-box;
}
.auth-input:focus { border-color: #f97316; }
.auth-error { color: #dc2626; font-size: 13px; }
.auth-submit { padding: 11px; font-size: 15px; border-radius: 8px; cursor: pointer; }
.auth-toggle {
  background: none; border: none; color: #f97316; font-size: 13px;
  cursor: pointer; text-decoration: underline; padding: 4px;
}
.user-chip {
  display: flex; align-items: center; gap: 8px; margin-right: 8px;
  font-size: 12.5px; color: #475569;
}
.user-chip-logout {
  background: none; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 11.5px; padding: 3px 8px; cursor: pointer; color: #64748b;
}
.user-chip-logout:hover { background: #f1f5f9; color: #1e293b; }
