/* Constructor v3: librería de plantillas, lienzo compacto y paleta de preguntas. */
.p3-fe-status{
  flex:none;display:inline-flex;align-items:center;justify-content:center;
  min-height:28px;padding:0 10px;border-radius:999px;
  font:700 11px/1 Inter,system-ui,sans-serif;letter-spacing:.02em;white-space:nowrap
}
.p3-fe-status.is-draft{background:#eef3f6;color:var(--navy,#05223a);border:1px solid var(--line,#d7e0e6)}
.p3-fe-status.is-pub{background:#e6f5f6;color:var(--teal-d,#007883);border:1px solid #b7e0e4}
.p3-fe-publish-top{
  display:none;align-items:center;justify-content:center;gap:6px;flex:none;
  min-height:48px;padding:0 16px;border:0;border-radius:999px;
  background:var(--teal,#007883);color:#fff;font:700 14px/1 Inter,system-ui,sans-serif;cursor:pointer
}
.p3-fe-publish-top .i{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.p3-fe-publish-top[disabled]{opacity:.45}

.p3-fe-toolbar{display:flex;align-items:center;gap:8px;margin:0 20px 10px}
.p3-fe-library-btn{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:48px;padding:0 18px;border:1.5px solid var(--line,#d7e0e6);border-radius:999px;
  background:#fff;color:var(--navy,#05223a);font:700 14px Inter,system-ui,sans-serif;cursor:pointer
}
.p3-fe-library-btn:hover,.p3-fe-library-btn:focus-visible{border-color:var(--teal,#007883);background:#e6f5f6}
.p3-fe-library-btn:focus-visible{outline:2px solid var(--teal,#007883);outline-offset:2px}

.p3-fe-info{margin:0 20px 12px}
.p3-fe-info-toggle{
  display:flex;align-items:center;gap:8px;width:100%;min-height:48px;padding:0 12px;
  border:1px solid var(--line,#d7e0e6);border-radius:14px;background:#fff;
  color:var(--navy,#05223a);font:600 13px/1.3 Inter,system-ui,sans-serif;text-align:left;cursor:pointer
}
.p3-fe-info-toggle .i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.p3-fe-info-toggle span{flex:1;min-width:0}
.p3-fe-info-toggle[aria-expanded=true]{border-bottom-left-radius:0;border-bottom-right-radius:0}
.p3-fe-info-body{padding:8px 12px 12px;border:1px solid var(--line,#d7e0e6);border-top:0;border-radius:0 0 14px 14px;background:#fff}
.p3-fe-info-body .p3-fe-warn,
.p3-fe-info-body .p3-fe-note,
.p3-fe-info-body .p3-fe-indep{margin:8px 0 0;padding:8px 10px}
.p3-fe-info-body .p3-fe-warn:first-child,
.p3-fe-info-body .p3-fe-note:first-child,
.p3-fe-info-body .p3-fe-indep:first-child{margin-top:0}

.p3-fe-work{margin:0 20px;display:flex;flex-direction:column;gap:16px;min-width:0;max-width:100%;box-sizing:border-box}
.p3-fe-palette{display:none}
.p3-fe-palette h3,.p3-fe-pal-sheet h3{
  margin:0 0 8px;font:800 13px/1.2 Inter,system-ui,sans-serif;color:var(--navy,#05223a)
}
.p3-fe-pal-lead{margin:12px 0 8px;font:700 11px/1.2 Inter,system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase;color:var(--teal-d,#007883)}
.p3-fe-pal-list{display:flex;flex-direction:column;gap:8px}
.p3-fe-chip{
  display:flex;align-items:center;gap:10px;width:100%;min-height:48px;padding:0 12px;
  border:1.5px solid var(--line,#d7e0e6);border-radius:14px;background:#fff;
  color:var(--navy,#05223a);font:600 14px/1.2 Inter,system-ui,sans-serif;text-align:left;cursor:grab
}
.p3-fe-chip .i{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;color:var(--teal-d,#007883)}
.p3-fe-chip:hover,.p3-fe-chip:focus-visible{border-color:var(--teal,#007883);background:#e6f5f6}
.p3-fe-chip:focus-visible{outline:2px solid var(--teal,#007883);outline-offset:2px}
.p3-fe-chip.is-dragging{opacity:.55}
.p3-fe-pal-empty{margin:0;color:#5b6e7e;font:500 13px/1.4 Inter,system-ui,sans-serif}

body.view-reports[data-p3=form] #editor-fields fieldset.is-active legend{color:var(--teal,#007883)}
body.view-reports[data-p3=form] #editor-fields fieldset.is-drop{
  outline:2px dashed var(--teal,#007883);outline-offset:4px;border-radius:14px;background:#f3fbfb
}

.p3-fe-drop{
  display:flex;align-items:center;justify-content:center;min-height:8px;
  border-radius:12px;color:#5b6e7e;font:500 12px/1.3 Inter,system-ui,sans-serif
}
.p3-fe-drop span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
body.view-reports[data-p3=form] #editor-fields fieldset.is-drop .p3-fe-drop{
  min-height:48px;border:1.5px dashed var(--teal,#007883);background:#fff;color:var(--teal-d,#007883)
}
body.view-reports[data-p3=form] #editor-fields fieldset.is-drop .p3-fe-drop span{
  position:static;width:auto;height:auto;overflow:visible;clip:auto
}

/* Lienzo compacto: la edición va en la hoja, no debajo de la fila. */
body.view-reports[data-p3=form] .fg2-row{
  display:flex;flex-wrap:nowrap;align-items:center;gap:8px;
  padding:4px 6px 4px 4px;min-height:56px
}
body.view-reports[data-p3=form] .fg2-row .fg2-show,
body.view-reports[data-p3=form] .fg2-row .fg2-rename,
body.view-reports[data-p3=form] .fg2-row .fg2-props,
body.view-reports[data-p3=form] .fg2-row.is-sel .fg2-show,
body.view-reports[data-p3=form] .fg2-row.is-sel .fg2-rename,
body.view-reports[data-p3=form] .fg2-row.is-sel .fg2-props{
  display:none
}
body.view-reports[data-p3=form] .fg2-drag,
body.view-reports[data-p3=form] .fg2-icon{
  width:48px;height:48px;min-height:48px;min-width:48px
}
body.view-reports[data-p3=form] .p3-fe-ti{width:28px;height:28px;flex:none}
body.view-reports[data-p3=form] .fg2-row-tools{display:flex;flex:none;gap:2px}
@media (max-width:1023px){
  body.view-reports[data-p3=form] .fg2-row-tools [data-move]{
    position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0
  }
}

body.view-reports[data-p3=form] .editor-sticky #p3-fe-add,
.p3-fe-add{
  flex:1 1 100%;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:48px;margin:0;padding:0 18px;border:1.5px solid var(--teal,#007883);border-radius:999px;
  background:#fff;color:var(--teal-d,#007883);font:700 15px Inter,system-ui,sans-serif;cursor:pointer
}
.p3-fe-add .i{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.p3-fe-add:hover,.p3-fe-add:focus-visible{background:#e6f5f6}
.p3-fe-add[hidden]{display:none}

.p3-fe-sheet .x{
  width:48px;height:48px;min-width:48px;min-height:48px;right:8px;top:8px;
  display:grid;place-items:center
}
.p3-fe-sheet-lib{width:min(100%,560px);max-height:min(90vh,820px)}
.p3-fe-sheet-lib .p3-tpl-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.p3-fe-edit-body{display:flex;flex-direction:column;gap:12px;margin:0 0 16px}
.p3-fe-edit-field{display:flex;flex-direction:column;gap:6px;margin:0;font:600 13px/1.3 Inter,system-ui,sans-serif;color:var(--navy,#05223a)}
.p3-fe-edit-field input,.p3-fe-edit-field select,.p3-fe-edit-field textarea{
  min-height:48px;padding:10px 12px;border:1.5px solid var(--line,#d7e0e6);border-radius:14px;
  background:#fff;color:var(--navy,#05223a);font:500 15px/1.3 Inter,system-ui,sans-serif
}
.p3-fe-edit-field textarea{min-height:96px;resize:vertical}
.p3-fe-edit-check{
  display:flex;align-items:center;gap:10px;min-height:48px;margin:0;
  font:600 15px/1.3 Inter,system-ui,sans-serif;color:var(--navy,#05223a)
}
.p3-fe-edit-check input{width:22px;height:22px;accent-color:var(--teal,#007883)}

@media (min-width:1024px){
  .p3-fe-publish-top{display:inline-flex}
  .p3-fe-toolbar,.p3-fe-info,.p3-fe-work,.p3-fe-tabs{margin-left:0;margin-right:0}
  .p3-fe-work{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:20px;align-items:start}
  .p3-fe-palette{
    display:block;position:sticky;top:72px;padding:14px;border:1px solid var(--line,#d7e0e6);
    border-radius:16px;background:#fff;box-sizing:border-box
  }
  body.view-reports[data-p3=form] .editor-sticky #p3-fe-add,
  .p3-fe-add{display:none}
  .p3-fe-drop{
    min-height:36px;border:1.5px dashed var(--line,#d7e0e6)
  }
  .p3-fe-drop span{position:static;width:auto;height:auto;overflow:visible;clip:auto}
  .p3-fe-sheet-lib,.p3-fe-sheet-add,.p3-fe-sheet-edit{border-radius:20px}
}

body.view-reports[data-p3=form] #editor{
  padding-bottom:calc(200px + env(safe-area-inset-bottom,0px))
}
@media (min-width:1024px){
  body.view-reports[data-p3=form] #editor{padding-bottom:48px}
}


/* Las plantillas y chips no heredan el botón teal/navy global de app.css. */
.p3-tpl-card,
.p3-tpl-card:hover,
.p3-tpl-card:focus,
.p3-tpl-card:active,
.p3-tpl-card:focus-visible{
  background:#fff;
  color:var(--navy,#05223a);
  border:1px solid var(--line,#d7e0e6)
}
.p3-tpl-card:hover,
.p3-tpl-card:focus-visible{
  border-color:var(--teal,#007883);
  background:#fff;
  color:var(--navy,#05223a)
}
.p3-tpl-card strong{color:var(--navy,#05223a)}
.p3-tpl-card span{color:var(--text-teal,#007883)}
.p3-fe-chip:hover,
.p3-fe-chip:focus,
.p3-fe-chip:focus-visible{
  background:#e6f5f6;
  color:var(--navy,#05223a)
}

/* En la hoja, el título ya está en el h2. */
.p3-fe-pal-sheet > h3{display:none}

/* El botón Guía no tapa el lienzo ni la paleta. */
body.is-in[data-p3=form] #p3-guide-dock{
  display:none !important
}

/* En el teléfono, el lápiz y el basurero quedan enteros dentro de la fila. */
body.view-reports[data-p3=form] #editor,
body.view-reports[data-p3=form] #form-editor,
body.view-reports[data-p3=form] #p3-fe-work,
body.view-reports[data-p3=form] #editor-fields,
body.view-reports[data-p3=form] #editor-fields fieldset,
body.view-reports[data-p3=form] .fg2-row{
  min-width:0;
  max-width:100%;
  box-sizing:border-box
}
body.view-reports[data-p3=form] #editor-fields,
body.view-reports[data-p3=form] #editor-fields fieldset,
body.view-reports[data-p3=form] .fg2-row{
  width:100%
}
body.view-reports[data-p3=form] .fg2-row{
  overflow:hidden;
  flex-wrap:nowrap
}
body.view-reports[data-p3=form] .p3-fe-tx{
  flex:1 1 0;
  min-width:0;
  max-width:100%;
  overflow:hidden
}
body.view-reports[data-p3=form] .fg2-row-tools{
  flex:none;
  flex-shrink:0;
  margin-left:auto
}

@media (max-width:1023px){
  body.view-reports[data-p3=form] .p3-fe-ti{display:none}
  body.view-reports[data-p3=form] .fg2-row{
    display:grid;
    grid-template-columns:44px minmax(0,1fr) auto;
    align-items:center;
    gap:6px;
    width:100%;
    max-width:100%;
    min-width:0;
    box-sizing:border-box;
    padding:4px max(8px, env(safe-area-inset-right, 0px)) 4px 4px;
    overflow:hidden
  }
  body.view-reports[data-p3=form] .fg2-drag{
    grid-column:1;
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px
  }
  body.view-reports[data-p3=form] .p3-fe-tx{
    grid-column:2;
    min-width:0;
    max-width:100%;
    overflow:hidden
  }
  body.view-reports[data-p3=form] .fg2-row-tools{
    grid-column:3;
    display:flex;
    flex:none;
    flex-shrink:0;
    gap:2px;
    margin-left:0
  }
  body.view-reports[data-p3=form] .fg2-icon{
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px
  }
}
