/* ==========================================================================
   manuales-editor.css — BCS Creative Studio / Word Editor (Lienzo A4 + Ribbon)
   Soporte completo y sincronizado para Modo Claro y Modo Oscuro (:root[data-theme])
   ========================================================================== */

/* ===== Ocultar Layout Global mientras el Editor esté Activo ===== */
body.man-editor-on .topbar,
body.man-editor-on .site-foot,
body.man-editor-on #navBallWidget {
  display: none !important;
}

/* ===== Vista Completa del Editor ===== */
#v-manuales-editor {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100vw !important;
  width: 100% !important;
  min-height: 100vh;
  background: var(--bg);
}
#v-manuales-editor .wrap {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

.med-word-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans, 'Poppins', sans-serif);
}

/* ==========================================================================
   RIBBON TOOLBAR (2 NIVELES TIPO MICROSOFT WORD / CREATIVE STUDIO)
   ========================================================================== */

.med-ribbon-bar {
  position: sticky;
  top: 0;
  z-index: 120;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: background .2s ease, border-color .2s ease;
}

:root[data-theme="dark"] .med-ribbon-bar {
  background: #111827;
  border-bottom: 1px solid #1f2937;
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.5);
}

/* ----- TIER 1: Barra de Acción Superior & Pestañas de Documentos ----- */
.med-ribbon-tier1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  min-height: 52px;
  border-bottom: 1px solid var(--border-soft, rgba(0, 0, 0, 0.05));
  gap: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

:root[data-theme="dark"] .med-ribbon-tier1 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.med-ribbon-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.med-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.med-btn-back:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
  transform: translateX(-1px);
}

.med-ribbon-logo {
  height: 28px;
  width: auto;
  display: block;
}
:root[data-theme="dark"] .med-ribbon-logo {
  content: url("/assets/logo-bcs-blanco.png");
}

.med-doc-title-box {
  display: flex;
  flex-direction: column;
}
.med-doc-app-name {
  font-family: var(--display, 'Quicksand', sans-serif);
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.med-doc-status-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.med-doc-status-badge.dirty {
  color: #f59e0b;
  font-weight: 600;
}
.med-doc-status-badge.clean {
  color: #10b981;
}

/* Pestañas de Documentos (Word Docs Tabs) */
.med-ribbon-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 4px;
  flex: 1 1 auto;
  min-width: 140px;
  max-width: 480px;
  margin: 0 12px;
}
.med-ribbon-tabs::-webkit-scrollbar { height: 3px; }
.med-ribbon-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.med-doc-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  position: relative;
}
.med-doc-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}
.med-doc-tab.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  border-color: rgba(62, 53, 168, 0.2);
  box-shadow: 0 2px 6px -1px rgba(62, 53, 168, 0.1);
}
:root[data-theme="dark"] .med-doc-tab.active {
  background: rgba(129, 140, 248, 0.14);
  border-color: rgba(129, 140, 248, 0.3);
  color: #a5b4fc;
}
.med-doc-tab .tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.med-doc-tab .tab-dot.pub { background: #10b981; }
.med-doc-tab .tab-dot.draft { background: #f59e0b; }

.med-doc-tab-new {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-faint);
  display: grid;
  place-items: center;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s ease;
}
.med-doc-tab-new:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

/* Acciones Derecha Tier 1 */
.med-ribbon-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.med-tb-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: all .14s ease;
}
.med-tb-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.med-tb-btn:active {
  transform: scale(.95);
}
.med-tb-btn.active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}

.med-theme-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.med-theme-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.med-btn-group-pill {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.med-btn-group-pill .med-tb-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 13px;
}

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

.med-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.med-btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .med-btn-outline {
  background: #1f2937;
  border-color: #374151;
}

.med-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px -2px rgba(62, 53, 168, 0.4);
  transition: all .15s ease;
  white-space: nowrap;
}
.med-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.med-btn-primary:active {
  transform: translateY(0);
}

/* ----- TIER 2: Galería de Estilos de Bloques & Controles de Formato ----- */
.med-ribbon-tier2 {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 8px 18px;
  min-height: 72px;
  overflow-x: auto;
  background: var(--surface-2);
}
:root[data-theme="dark"] .med-ribbon-tier2 {
  background: #0f172a;
}
.med-ribbon-tier2::-webkit-scrollbar { height: 4px; }
.med-ribbon-tier2::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.med-ribbon-section {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}
.med-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  text-align: center;
}

.med-ribbon-divider {
  width: 1px;
  background: var(--border);
  margin: 2px 0;
  align-self: stretch;
}

/* Galería de Estilos (Word Style Chips) */
.med-ribbon-chips-gallery {
  display: flex;
  align-items: center;
  gap: 6px;
}
.med-style-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 4px 2px;
  transition: all .15s ease;
  font-family: inherit;
  flex-shrink: 0;
}
:root[data-theme="dark"] .med-style-chip {
  background: #1e293b;
  border-color: #334155;
}
.med-style-chip:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px -2px rgba(62, 53, 168, 0.2);
}
.med-style-chip .chip-sample {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
  display: block;
}
.med-style-chip .sample-p { font-weight: 500; font-size: 15px; }
.med-style-chip .sample-h1 {
  background: linear-gradient(135deg, var(--brand), #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 16px;
  font-weight: 800;
}
.med-style-chip .sample-h2 { font-weight: 700; font-size: 14px; color: var(--brand); }
.med-style-chip .sample-code {
  font-family: var(--mono, monospace);
  font-size: 12px;
  background: #1e293b;
  color: #38bdf8;
  padding: 1px 4px;
  border-radius: 4px;
}
.med-style-chip .sample-list { color: #10b981; font-size: 14px; }
.med-style-chip .sample-alert { color: #f59e0b; font-size: 14px; }
.med-style-chip .sample-img { color: #818cf8; font-size: 14px; }
.med-style-chip .sample-video { color: #ec4899; font-size: 14px; }
.med-style-chip .sample-diagram { color: #6366f1; font-size: 15px; }

.med-style-chip .chip-label {
  font-size: 10px;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
}

/* Tipografía Inline */
.med-inline-fmt-group {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
}
.med-ribbon-select {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 0 6px;
  outline: none;
}
:root[data-theme="dark"] .med-ribbon-select {
  background: #1e293b;
  border-color: #334155;
}
.med-ribbon-select.font-sel { width: 130px; }
.med-ribbon-select.size-sel { width: 64px; }

.med-fmt-btns {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
:root[data-theme="dark"] .med-fmt-btns {
  background: #1e293b;
  border-color: #334155;
}
.med-tb-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  color: var(--text-soft, #475569);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s ease;
}
.med-tb-btn:hover {
  background: var(--surface-2, #f1f5f9);
  color: var(--brand, #3b3296);
  border-color: var(--brand, #3b3296);
}
.med-tb-btn.active {
  background: var(--brand, #3b3296) !important;
  color: #ffffff !important;
  border-color: var(--brand, #3b3296) !important;
  box-shadow: 0 2px 8px rgba(59, 50, 150, 0.35);
}
:root[data-theme="dark"] .med-tb-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}
:root[data-theme="dark"] .med-tb-btn:hover {
  background: #243048;
  color: #818cf8;
  border-color: #818cf8;
}
:root[data-theme="dark"] .med-tb-btn.active {
  background: #6366f1 !important;
  color: #ffffff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.45);
}
.med-tb-btn.sm {
  width: 26px;
  height: 26px;
  font-size: 12px;
  border-radius: 4px;
}
.med-tb-color-label {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-soft);
  position: relative;
  font-size: 12px;
}
.med-tb-color-label:hover {
  background: var(--surface-2);
  color: var(--brand);
}
.color-picker-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Herramientas de Vista & Lienzo */
.med-view-tools-group {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
}

/* ==========================================================================
   MESA DE TRABAJO (WORKBENCH) & HOJA A4 CENTRADA
   ========================================================================== */

.med-workbench-container {
  min-height: calc(100vh - 124px);
  padding: 44px 20px 80px;
  background: var(--paper);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: background .2s ease;
  position: relative;
  width: 100%;
}

:root[data-theme="light"] .med-workbench-container {
  background: #f1f4f9;
}
:root[data-theme="dark"] .med-workbench-container {
  background: #080c14;
}

/* Hoja A4 Centrada */
.med-sheet-paper {
  width: 100%;
  max-width: 860px;
  min-height: 1160px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 56px 64px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all .25s ease;
}

:root[data-theme="light"] .med-sheet-paper {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 16px 44px -10px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.04);
}

:root[data-theme="dark"] .med-sheet-paper {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 20px 52px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.07);
}

/* Modo de presentación split / 2 columnas */
.med-sheet-paper.split-30 {
  max-width: 1260px !important;
}
.med-sheet-paper.split-30 .med-sheet-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}
.med-sheet-paper.split-30 .wys-block {
  width: 100%;
}
.med-sheet-paper.split-30 .wys-block:has(.man-title-grad),
.med-sheet-paper.split-30 .wys-block:has(.med-flowchart-box),
.med-sheet-paper.split-30 .wys-block[data-span="full"] {
  grid-column: 1 / -1;
}

/* Grilla milimetrada técnica de alta visibilidad (Canvas Millimeter Pattern) */
:root[data-theme="light"] .med-sheet-paper.grid-on,
.med-sheet-paper.grid-on {
  background-color: #ffffff !important;
  background-image:
    radial-gradient(circle, rgba(59, 50, 150, 0.35) 1.5px, transparent 1.5px),
    linear-gradient(to right, rgba(59, 50, 150, 0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 50, 150, 0.12) 1px, transparent 1px) !important;
  background-size: 20px 20px, 20px 20px, 20px 20px !important;
}
:root[data-theme="dark"] .med-sheet-paper.grid-on {
  background-color: #111827 !important;
  background-image:
    radial-gradient(circle, rgba(129, 140, 248, 0.45) 1.5px, transparent 1.5px),
    linear-gradient(to right, rgba(129, 140, 248, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(129, 140, 248, 0.18) 1px, transparent 1px) !important;
  background-size: 20px 20px, 20px 20px, 20px 20px !important;
}

/* Guías inteligentes Canvas (Eje Central & Márgenes A4) */
.med-sheet-paper.guides-on {
  position: relative;
}
.med-sheet-paper.guides-on::before {
  content: 'EJE CENTRAL';
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  background: rgba(239, 68, 68, 0.4);
  border-left: 1px dashed #ef4444;
  z-index: 8;
  pointer-events: none;
  font-size: 9px;
  color: #ef4444;
  letter-spacing: 1px;
  padding-left: 4px;
}
.med-sheet-paper.guides-on::after {
  content: '';
  position: absolute;
  top: 30mm; bottom: 25mm; left: 20mm; right: 20mm;
  border: 1px dashed rgba(14, 165, 233, 0.4);
  z-index: 7;
  pointer-events: none;
}

/* Cabecera de la Hoja A4 */
.med-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 34px;
  user-select: none;
}
.med-sheet-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.med-sheet-brand-logo {
  height: 32px;
  width: auto;
  display: block;
}
:root[data-theme="dark"] .med-sheet-brand-logo {
  content: url("/assets/logo-bcs-blanco.png");
}

.med-sheet-brand-text {
  display: flex;
  flex-direction: column;
}
.med-sheet-brand-text .title {
  font-family: var(--display, 'Quicksand', sans-serif);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--brand);
}
.med-sheet-brand-text .subtitle {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}
.med-sheet-doc-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-ghost);
}

/* Contenedor del Cuerpo de Bloques */
.med-sheet-body {
  flex: 1;
  min-height: 480px;
}

/* Pie de Página de la Hoja A4 */
.med-sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  margin-top: 48px;
  font-size: 11.5px;
  color: var(--text-faint);
  user-select: none;
}

/* Estado Vacío de la Hoja */
.med-stage-empty {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-faint);
}
.med-stage-empty i {
  font-size: 2.8rem;
  opacity: .35;
  display: block;
  margin-bottom: 12px;
  color: var(--brand);
}
.med-stage-empty p {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  margin: 0 0 6px;
}
.med-stage-empty span {
  font-size: .88rem;
}

/* ==========================================================================
   BLOQUES WYSIWYG & COMPONENTES DOCUMENTALES
   ========================================================================== */

.wys-block {
  position: relative;
  border-radius: 8px;
  padding: 4px 32px 4px 28px;
  margin-bottom: 6px;
  border: 1.5px dashed transparent;
  transition: all .15s ease;
}
.wys-block:hover {
  border-color: var(--border);
  background: rgba(62, 53, 168, 0.02);
}
:root[data-theme="dark"] .wys-block:hover {
  background: rgba(129, 140, 248, 0.04);
}

.wys-handle {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  cursor: grab;
  color: var(--text-faint);
  font-size: 14px;
  user-select: none;
  opacity: 0;
  transition: opacity .15s ease;
  padding: 4px;
}
.wys-block:hover .wys-handle { opacity: 0.8; }
.wys-handle:active { cursor: grabbing; color: var(--brand); }

/* Barra de herramientas flotante de cada bloque */
.med-block-tools {
  position: absolute;
  right: 4px;
  top: -30px;
  display: flex;
  gap: 2px;
  background: var(--text);
  color: var(--surface);
  border-radius: 8px;
  padding: 3px;
  opacity: 0;
  pointer-events: none;
  transition: all .15s ease;
  z-index: 40;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.wys-block:hover .med-block-tools {
  opacity: 1;
  pointer-events: auto;
}
.med-tool-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: inherit;
  opacity: .85;
  border-radius: 5px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: .85rem;
}
.med-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}
.med-tool-btn.danger:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Contenido Editable */
.wys {
  outline: none;
  border-radius: 4px;
  transition: box-shadow .15s ease;
}
.wys-editing {
  box-shadow: 0 0 0 2px var(--brand), 0 0 0 5px rgba(62, 53, 168, 0.15);
  background: rgba(62, 53, 168, 0.03);
  cursor: text !important;
}

/* Tipografía de Bloques */
.man-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--eyebrow-bg);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.man-title-grad {
  font-family: var(--display, 'Quicksand', sans-serif);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: text;
}

.man-sub-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1.6rem 0 .6rem;
}
.man-sub-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.man-sub-head h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  cursor: text;
}
.man-gradient-rule {
  height: 2px;
  border: none;
  background: linear-gradient(to right, var(--brand), rgba(62, 53, 168, 0.1));
  margin: 4px 0 16px;
}

.man-bloque-texto-p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 1.1rem;
  cursor: text;
}

/* Checklist de Lista */
.man-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.man-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  font-size: .98rem;
  line-height: 1.6;
}
.man-checklist li i {
  color: #10b981;
  font-size: 1.05rem;
  margin-top: 2px;
  flex-shrink: 0;
}
.wys-additem {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-faint);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .8rem;
  cursor: pointer;
  margin-bottom: .8rem;
}
.wys-additem:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

/* Bloque de Código / Terminal */
.man-bloque-codigo {
  background: #0f172a;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin: 12px 0 18px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.25);
}
.man-term-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 6px;
}
.man-term-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.man-term-bar .dot.r { background: #ef4444; }
.man-term-bar .dot.y { background: #f59e0b; }
.man-term-bar .dot.g { background: #10b981; }

.man-term-lang-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-family: var(--mono, monospace);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  outline: none;
  margin-left: auto;
  text-transform: uppercase;
}
.wys-code {
  background: transparent;
  color: #e2e8f0;
  font-family: var(--mono, monospace);
  font-size: 13px;
  line-height: 1.6;
  padding: 14px 16px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
  cursor: text;
}

/* Callout / Alerta */
.med-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: 10px;
  margin: 14px 0 18px;
  border-left: 4px solid;
}
.med-callout.alerta-warn, .med-callout.warning {
  background: var(--warn-soft, #fef3c7);
  border-left-color: #f59e0b;
  color: #92400e;
}
:root[data-theme="dark"] .med-callout.alerta-warn, :root[data-theme="dark"] .med-callout.warning {
  background: #271c08;
  color: #fde68a;
  border-left-color: #f59e0b;
}
.med-callout.alerta-danger, .med-callout.peligro {
  background: var(--err-soft, #fee2e2);
  border-left-color: #ef4444;
  color: #991b1b;
}
:root[data-theme="dark"] .med-callout.alerta-danger, :root[data-theme="dark"] .med-callout.peligro {
  background: #310c0c;
  color: #fca5a5;
  border-left-color: #ef4444;
}
.med-callout.alerta-info, .med-callout.info {
  background: var(--teal-soft, #e0f2fe);
  border-left-color: #0ea5e9;
  color: #075985;
}
:root[data-theme="dark"] .med-callout.alerta-info, :root[data-theme="dark"] .med-callout.info {
  background: #08283b;
  color: #bae6fd;
  border-left-color: #38bdf8;
}

.med-callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.med-callout-content {
  flex: 1;
}
.med-callout-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  cursor: text;
}
.med-callout-text {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  cursor: text;
}

/* Imagen y Video */
.man-bloque-imagen {
  border-radius: 12px;
  overflow: hidden;
  margin: 14px 0 20px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.man-bloque-imagen img {
  width: 100%;
  height: auto;
  display: block;
}
.wys-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 48px 20px;
  color: var(--text-faint);
  font-size: .9rem;
}
.wys-img-empty i { font-size: 2rem; color: var(--brand); opacity: .7; }

.wys-ghost {
  opacity: .4;
  background: var(--brand-soft) !important;
  outline: 2px dashed var(--brand);
}
.wys-chosen {
  box-shadow: 0 16px 36px rgba(62, 53, 168, 0.25);
}

/* ==========================================================================
   GESTOR MODAL DE SDks Y COLECCIONES POSTMAN
   ========================================================================== */

.med-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(11, 15, 25, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: medFadeIn .2s ease;
}
@keyframes medFadeIn { from { opacity: 0; } to { opacity: 1; } }

.med-modal-card {
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: medScaleIn .2s ease;
}
:root[data-theme="dark"] .med-modal-card {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 30px 80px -12px rgba(0, 0, 0, 0.8);
}
@keyframes medScaleIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.med-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.med-modal-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.med-modal-title i {
  font-size: 1.8rem;
  color: var(--brand);
}
.med-modal-title h3 {
  font-family: var(--display, sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.med-modal-title p {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 2px 0 0;
}
.med-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: all .15s ease;
}
.med-modal-close:hover {
  background: var(--err-soft);
  color: var(--err);
}

.med-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.med-assets-service-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
:root[data-theme="dark"] .med-assets-service-section {
  background: #1a2234;
  border-color: #283548;
}
.med-assets-service-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.med-assets-service-head i {
  font-size: 1.2rem;
  color: var(--brand);
}
.med-assets-service-head h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.med-assets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 680px) {
  .med-assets-grid { grid-template-columns: 1fr; }
}

.med-asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color .15s ease;
}
:root[data-theme="dark"] .med-asset-card {
  background: #111827;
  border-color: #1f2937;
}
.med-asset-card:hover {
  border-color: var(--brand);
}

.med-asset-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.med-asset-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.med-asset-card-icon.postman {
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}
.med-asset-card-icon.android {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
.med-asset-card-icon.ios {
  background: rgba(100, 116, 139, 0.15);
  color: #475569;
}
.med-asset-card-icon.flutter {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
}

.med-asset-card-info {
  flex: 1;
  min-width: 0;
}
.med-asset-card-info h5 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text);
}
.med-asset-file-name {
  font-size: 12px;
  font-family: var(--mono, monospace);
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.med-asset-meta-text {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.med-asset-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.med-asset-btn-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all .15s ease;
}
.med-asset-btn-action:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}
.med-asset-btn-action.danger:hover {
  background: var(--err-soft);
  color: var(--err);
  border-color: var(--err);
}

.med-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
:root[data-theme="dark"] .med-modal-footer {
  background: #0f172a;
}
.med-modal-tip {
  font-size: 12px;
  color: var(--text-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   PALETA RÁPIDA DE COMANDOS (⌘K) & BOTÓN FAB
   ========================================================================== */

.med-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 100;
}
.med-fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, #0ea5e9 100%);
  color: #fff;
  font-size: 1.3rem;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px -6px rgba(62, 53, 168, 0.45);
  transition: transform .18s ease;
}
.med-fab-btn:hover {
  transform: scale(1.08) rotate(4deg);
}

.med-cmdk {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 990;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.med-cmdk-panel {
  width: 540px;
  max-width: 92vw;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: medCmdIn .18s ease;
}
:root[data-theme="dark"] .med-cmdk-panel {
  background: #111827;
  border-color: #1f2937;
}
@keyframes medCmdIn { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; } }

.med-cmdk-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.med-cmdk-search i { color: var(--text-faint); }
.med-cmdk-search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: .96rem;
  color: var(--text);
  background: transparent;
}
.med-cmdk-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}
.med-cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .12s;
  color: var(--text);
}
.med-cmd-item.cmd-active, .med-cmd-item:hover {
  background: var(--brand-soft);
}
:root[data-theme="dark"] .med-cmd-item.cmd-active, :root[data-theme="dark"] .med-cmd-item:hover {
  background: rgba(129, 140, 248, 0.14);
}
.med-cmd-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand) 0%, #0ea5e9 100%);
  color: #fff;
  font-size: .95rem;
  flex-shrink: 0;
}
.med-cmd-txt {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.med-cmd-txt b { font-size: .9rem; font-weight: 600; color: var(--text); }
.med-cmd-txt small { font-size: .78rem; color: var(--text-faint); }
.med-cmd-item kbd, .med-cmdk-foot kbd {
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-faint);
}
.med-cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-faint);
}

/* ==========================================================================
   TOASTS & NOTIFICACIONES
   ========================================================================== */

.med-toast {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--surface);
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 500;
  font-size: .9rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
  transition: transform .3s ease;
  z-index: 1000;
}
.med-toast.show {
  display: block;
  transform: translateX(-50%) translateY(0);
}
.med-toast.success { background: #10b981; color: #fff; }
.med-toast.error { background: #ef4444; color: #fff; }
.med-toast.info { background: var(--brand); color: #fff; }

/* Responsive */
@media (max-width: 900px) {
  .med-sheet-paper {
    padding: 36px 24px;
    min-height: auto;
  }
  .man-title-grad { font-size: 1.6rem; }
  .med-ribbon-tier1 {
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   DIAGRAMAS DE FLUJO ARQUITECTÓNICOS (FLOWCHARTS)
   ========================================================================== */
.med-flowchart-box {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 24px;
  margin: 18px 0;
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.05);
}
:root[data-theme="dark"] .med-flowchart-box {
  background: #151d2e;
  border-color: #243048;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.4);
}

.med-flowchart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-bottom: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
:root[data-theme="dark"] .med-flowchart-header {
  border-color: #243048;
}

.med-flowchart-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.med-flowchart-title-wrap i {
  color: var(--brand, #3b3296);
  font-size: 1.25rem;
}
:root[data-theme="dark"] .med-flowchart-title-wrap i {
  color: #818cf8;
}

.med-flowchart-title-wrap h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  outline: none;
  min-width: 140px;
}

.med-flowchart-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.med-flow-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface, #ffffff);
  color: var(--text, #1e293b);
  border: 1px solid var(--border, #cbd5e1);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.med-flow-action-btn:hover {
  background: var(--brand, #3b3296);
  color: #ffffff;
  border-color: var(--brand, #3b3296);
}
.med-flow-action-btn.template {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}
.med-flow-action-btn.template:hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}
:root[data-theme="dark"] .med-flow-action-btn {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}
:root[data-theme="dark"] .med-flow-action-btn:hover {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
}
:root[data-theme="dark"] .med-flow-action-btn.template {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.3);
}
:root[data-theme="dark"] .med-flow-action-btn.template:hover {
  background: #22c55e;
  color: #ffffff;
}

.med-flowchart-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.med-flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 540px;
  position: relative;
}

.med-flow-card {
  width: 100%;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all .2s ease;
  position: relative;
}
:root[data-theme="dark"] .med-flow-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.med-flow-step.inicio .med-flow-card {
  border-left: 4px solid #10b981;
}
.med-flow-step.proceso .med-flow-card {
  border-left: 4px solid #0ea5e9;
}
.med-flow-step.decision .med-flow-card {
  border-left: 4px solid #f59e0b;
}
.med-flow-step.fin .med-flow-card {
  border-left: 4px solid #8b5cf6;
}

.med-flow-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.med-flow-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
}
.med-flow-step.inicio .med-flow-badge { background: #dcfce7; color: #15803d; }
.med-flow-step.proceso .med-flow-badge { background: #e0f2fe; color: #0369a1; }
.med-flow-step.decision .med-flow-badge { background: #fef3c7; color: #b45309; }
.med-flow-step.fin .med-flow-badge { background: #ede9fe; color: #6d28d9; }

:root[data-theme="dark"] .med-flow-step.inicio .med-flow-badge { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
:root[data-theme="dark"] .med-flow-step.proceso .med-flow-badge { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
:root[data-theme="dark"] .med-flow-step.decision .med-flow-badge { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
:root[data-theme="dark"] .med-flow-step.fin .med-flow-badge { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }

.med-flow-del-btn {
  background: transparent;
  border: none;
  color: var(--text-faint, #94a3b8);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all .15s ease;
}
.med-flow-del-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}
:root[data-theme="dark"] .med-flow-del-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.med-flow-card-text {
  font-size: 0.88rem;
  line-height: 1.5;
  outline: none;
  min-height: 20px;
}

.med-flow-branches {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border, #e2e8f0);
  font-size: 0.78rem;
  font-weight: 600;
}
:root[data-theme="dark"] .med-flow-branches {
  border-color: #334155;
}
.med-branch-yes {
  color: #16a34a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.med-branch-no {
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.med-flow-arrow {
  color: var(--text-faint, #94a3b8);
  font-size: 1.1rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   ESTILOS DE LISTAS & VIÑETAS PERSONALIZADAS
   ========================================================================== */
.man-list-box {
  margin: 14px 0;
  position: relative;
}

.man-list-toolbar {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.man-list-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2, #f1f5f9);
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
}
:root[data-theme="dark"] .man-list-pills {
  background: #1e293b;
  border-color: #334155;
}

.med-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-faint, #64748b);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.med-pill-btn:hover {
  color: var(--text, #0f172a);
}
.med-pill-btn.active {
  background: var(--brand, #3b3296);
  color: #ffffff;
}
:root[data-theme="dark"] .med-pill-btn:hover {
  color: #f1f5f9;
}
:root[data-theme="dark"] .med-pill-btn.active {
  background: #6366f1;
  color: #ffffff;
}

.man-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 4px 0;
}
.man-dot-bullet {
  color: var(--brand, #3b3296);
  font-size: 1.2rem;
  line-height: 1;
}
.man-num-badge {
  color: var(--brand, #3b3296);
  font-weight: 700;
  font-size: 0.88rem;
  min-width: 20px;
}
.man-arrow-badge {
  color: #0ea5e9;
  font-size: 0.95rem;
}
:root[data-theme="dark"] .man-dot-bullet,
:root[data-theme="dark"] .man-num-badge {
  color: #818cf8;
}
:root[data-theme="dark"] .man-arrow-badge {
  color: #38bdf8;
}

.wys-del-item {
  background: transparent;
  border: none;
  color: var(--text-faint, #94a3b8);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease;
  margin-left: auto;
}
.man-checklist li:hover .wys-del-item {
  opacity: 1;
}
.wys-del-item:hover {
  color: #ef4444;
}

/* ==========================================================================
   POPOVER DE EMOTICONOS Y SÍMBOLOS OFFLINE
   ========================================================================== */
.med-emoji-picker-popover {
  position: fixed;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 12px;
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  overflow: hidden;
  animation: medEmojiFadeIn .18s ease-out;
}
:root[data-theme="dark"] .med-emoji-picker-popover {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.6);
}

@keyframes medEmojiFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.med-emoji-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
  font-size: 0.82rem;
  font-weight: 700;
}
:root[data-theme="dark"] .med-emoji-header {
  background: #151d2e;
  border-color: #334155;
}

.med-emoji-close {
  background: transparent;
  border: none;
  color: var(--text-faint, #64748b);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95rem;
}
.med-emoji-close:hover {
  color: #ef4444;
}

.med-emoji-body {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.med-emoji-cat-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint, #64748b);
  margin-bottom: 6px;
}
.med-emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.med-emoji-btn {
  background: var(--surface-2, #f1f5f9);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 1.25rem;
  padding: 8px 4px;
  cursor: pointer;
  transition: all .12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.med-emoji-btn:hover {
  background: var(--surface, #ffffff);
  border-color: var(--brand, #3b3296);
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
:root[data-theme="dark"] .med-emoji-btn {
  background: #0f172a;
}
:root[data-theme="dark"] .med-emoji-btn:hover {
  background: #334155;
  border-color: #818cf8;
}

/* ==========================================================================
   PARADIGMAS DE DIAGRAMAS: FLUJO, MAPA MENTAL, PIPELINE ETL Y ACCIONES
   ========================================================================== */

.med-diag-type-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2, #f1f5f9);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border, #cbd5e1);
}
:root[data-theme="dark"] .med-diag-type-pills {
  background: #0f172a;
  border-color: #334155;
}

.med-diag-pill {
  background: transparent;
  border: none;
  color: var(--text-faint, #64748b);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.med-diag-pill:hover {
  color: var(--text, #0f172a);
}
.med-diag-pill.active {
  background: var(--brand, #3b3296);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 50, 150, 0.35);
}
:root[data-theme="dark"] .med-diag-pill:hover {
  color: #f1f5f9;
}
:root[data-theme="dark"] .med-diag-pill.active {
  background: #6366f1;
  color: #ffffff;
}

.med-flow-action-btn.primary {
  background: var(--brand, #3b3296);
  color: #ffffff;
  border-color: var(--brand, #3b3296);
}
.med-flow-action-btn.primary:hover {
  background: #2c2574;
}
:root[data-theme="dark"] .med-flow-action-btn.primary {
  background: #6366f1;
  border-color: #6366f1;
}
:root[data-theme="dark"] .med-flow-action-btn.primary:hover {
  background: #4f46e5;
}

.med-flow-action-btn.ai {
  background: #fdf4ff;
  color: #a855f7;
  border-color: #f0abfc;
}
.med-flow-action-btn.ai:hover {
  background: #a855f7;
  color: #ffffff;
}
:root[data-theme="dark"] .med-flow-action-btn.ai {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.3);
}
:root[data-theme="dark"] .med-flow-action-btn.ai:hover {
  background: #a855f7;
  color: #ffffff;
}

/* Dropdown de Plantillas */
.med-diag-templates-dropdown {
  position: relative;
  display: inline-block;
}
.med-diag-templates-dropdown:hover .med-diag-tpl-menu,
.med-diag-templates-dropdown:focus-within .med-diag-tpl-menu {
  display: flex;
}
.med-diag-tpl-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(0,0,0,0.18);
  padding: 8px;
  width: 250px;
  flex-direction: column;
  gap: 3px;
  z-index: 100;
  animation: medEmojiFadeIn .15s ease-out;
}
:root[data-theme="dark"] .med-diag-tpl-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 16px 40px -4px rgba(0,0,0,0.7);
}
.med-diag-tpl-head {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint, #64748b);
  padding: 4px 8px 2px;
  margin-top: 4px;
}
.med-diag-tpl-menu button {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  text-align: left;
  cursor: pointer;
  transition: all .12s ease;
}
.med-diag-tpl-menu button:hover {
  background: var(--surface-2, #f1f5f9);
  color: var(--brand, #3b3296);
  padding-left: 14px;
}
:root[data-theme="dark"] .med-diag-tpl-menu button {
  color: #f1f5f9;
}
:root[data-theme="dark"] .med-diag-tpl-menu button:hover {
  background: #334155;
  color: #818cf8;
}

/* 1. MAPA MENTAL */
.med-mindmap-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px 0;
}
.med-mindmap-center {
  display: flex;
  justify-content: center;
}
.med-mind-hub {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 2px solid #8b5cf6;
  border-radius: 20px;
  padding: 16px 28px;
  text-align: center;
  max-width: 380px;
  box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.25);
  position: relative;
}
:root[data-theme="dark"] .med-mind-hub {
  background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 100%);
  border-color: #a78bfa;
  box-shadow: 0 10px 25px -5px rgba(167, 139, 250, 0.3);
}
.med-mind-hub-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #8b5cf6;
  color: #ffffff;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}
.med-mind-hub h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #4c1d95;
  margin: 0 0 4px;
  outline: none;
}
:root[data-theme="dark"] .med-mind-hub h4 {
  color: #ede9fe;
}
.med-mind-hub p {
  font-size: 0.8rem;
  color: #6d28d9;
  margin: 0;
  outline: none;
}
:root[data-theme="dark"] .med-mind-hub p {
  color: #c4b5fd;
}

.med-mindmap-branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .med-mindmap-branches { grid-template-columns: 1fr; }
}
.med-mind-branch {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-top: 4px solid var(--brand, #3b3296);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  transition: all .2s ease;
}
:root[data-theme="dark"] .med-mind-branch {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.med-mind-branch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #f1f5f9);
}
:root[data-theme="dark"] .med-mind-branch-head {
  border-color: #334155;
}
.med-mind-branch-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.med-mind-branch-title-wrap i {
  font-size: 1.15rem;
}
.med-mind-branch-title-wrap h5 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--text, #0f172a);
  outline: none;
}
:root[data-theme="dark"] .med-mind-branch-title-wrap h5 {
  color: #f1f5f9;
}
.med-mind-branch-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.med-mind-add-item-btn {
  background: transparent;
  border: none;
  color: var(--text-faint, #94a3b8);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all .15s ease;
}
.med-mind-add-item-btn:hover {
  color: var(--brand, #3b3296);
  background: var(--surface-2, #f1f5f9);
}

.med-mind-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.med-mind-item {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  font-size: 0.85rem;
}
.med-mind-item-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.med-mind-item-txt {
  flex: 1;
  outline: none;
  line-height: 1.4;
}
.med-mind-item-del {
  background: transparent;
  border: none;
  color: var(--text-faint, #94a3b8);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all .15s ease;
}
.med-mind-item:hover .med-mind-item-del {
  opacity: 1;
}
.med-mind-item-del:hover {
  color: #ef4444;
}

/* 2. PIPELINE ETL */
.med-etl-box {
  padding: 10px 0;
  overflow-x: auto;
}
.med-etl-stages {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 600px;
}
.med-etl-stage {
  flex: 1;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: relative;
  display: flex;
  flex-direction: column;
}
:root[data-theme="dark"] .med-etl-stage {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.med-etl-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.med-etl-phase-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 8px;
  border-radius: 4px;
}
:root[data-theme="dark"] .med-etl-phase-badge {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}
.med-etl-stage h5 {
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0 0 6px;
  outline: none;
  line-height: 1.3;
}
.med-etl-tech-wrap {
  margin-bottom: 8px;
}
.med-etl-tech {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--surface-2, #f1f5f9);
  color: var(--text-soft, #475569);
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
}
:root[data-theme="dark"] .med-etl-tech {
  background: #0f172a;
  color: #94a3b8;
}
.med-etl-stage p {
  font-size: 0.78rem;
  color: var(--text-soft, #475569);
  line-height: 1.4;
  margin: 0;
  outline: none;
  flex: 1;
}
:root[data-theme="dark"] .med-etl-stage p {
  color: #94a3b8;
}
.med-etl-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint, #94a3b8);
  font-size: 1.1rem;
  padding: 0 4px;
}

/* 3. ACCIONES DE APLICATIVO */
.med-actions-box {
  padding: 10px 0;
}
.med-actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.med-action-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
:root[data-theme="dark"] .med-action-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.med-action-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand, #3b3296);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}
:root[data-theme="dark"] .med-action-num {
  background: #6366f1;
}
.med-action-main {
  flex: 1;
}
.med-action-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.med-action-actor {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  outline: none;
}
:root[data-theme="dark"] .med-action-actor {
  color: #f1f5f9;
}
.med-action-method {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
}
:root[data-theme="dark"] .med-action-method {
  background: rgba(30, 64, 175, 0.3);
  color: #60a5fa;
}
.med-action-endpoint {
  font-family: var(--mono, monospace);
  font-size: 0.76rem;
  color: #0284c7;
  background: var(--surface-2, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
}
:root[data-theme="dark"] .med-action-endpoint {
  background: #0f172a;
  color: #38bdf8;
}
.med-action-card .med-flow-del-btn {
  margin-left: auto;
}
.med-action-card h5 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 4px;
  outline: none;
  color: var(--text, #0f172a);
}
:root[data-theme="dark"] .med-action-card h5 {
  color: #f1f5f9;
}
.med-action-card p {
  font-size: 0.82rem;
  color: var(--text-soft, #475569);
  margin: 0;
  outline: none;
  line-height: 1.4;
}
:root[data-theme="dark"] .med-action-card p {
  color: #94a3b8;
}

/* 4. ASISTENTE RÁPIDO & INTELIGENTE (MODAL) */
.med-diag-gen-card {
  max-width: 680px;
}
.med-diag-gen-shortcuts {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
}
:root[data-theme="dark"] .med-diag-gen-shortcuts {
  background: #1a2234;
  border-color: #283548;
}
.med-diag-gen-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint, #64748b);
  margin-bottom: 8px;
}
.med-diag-gen-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.med-gen-pill {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  cursor: pointer;
  transition: all .15s ease;
}
.med-gen-pill:hover {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #ffffff;
  transform: translateY(-1px);
}
:root[data-theme="dark"] .med-gen-pill {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
:root[data-theme="dark"] .med-gen-pill:hover {
  background: #a855f7;
  border-color: #a855f7;
  color: #ffffff;
}

.med-diag-gen-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.med-diag-gen-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.med-diag-gen-input-head label {
  font-size: 0.85rem;
  color: var(--text, #0f172a);
}
.med-diag-gen-hint {
  font-size: 0.74rem;
  color: var(--text-faint, #64748b);
  font-style: italic;
}
.med-diag-gen-textarea {
  width: 100%;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--mono, monospace);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text, #0f172a);
  resize: vertical;
  outline: none;
  transition: border-color .15s ease;
}
.med-diag-gen-textarea:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
:root[data-theme="dark"] .med-diag-gen-textarea {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}
:root[data-theme="dark"] .med-diag-gen-textarea:focus {
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

