/* Plantillas de Temple (plantillas-visuales.js): un día normal en tu vida y tu historia en orden. */

/* Psicólogo: las plantillas en Plantillas */
.pv-tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px;margin-bottom:8px}
.pv-tpl{border:1px solid var(--border);border-radius:12px;padding:14px;background:var(--card-bg);display:flex;flex-direction:column;gap:2px}
.pv-tpl-ico{font-size:22px;margin-bottom:4px}
.pv-tpl b{font-size:14px;font-weight:600;color:var(--ink);overflow-wrap:anywhere}
.pv-tpl-sub{font-size:12px;color:var(--text-secondary)}
.pv-tpl .act-link{align-self:flex-start;margin-top:8px}
.pv-type-grid{grid-template-columns:repeat(2,1fr)}

/* Consultante: llenarla en la app */
.pv-modes{margin-bottom:14px}
.pv-line{position:relative;padding-left:22px;margin-bottom:8px}
.pv-line::before{content:"";position:absolute;left:5px;top:8px;bottom:8px;width:2px;background:var(--camino-line);border-radius:2px}
.pv-mom,.pv-ev{position:relative;margin-bottom:10px}
.pv-dot{position:absolute;left:-22px;top:18px;width:12px;height:12px;border-radius:50%;background:var(--bg);border:2px solid var(--ink)}
.pv-ev .pv-dot{background:var(--ink)}
.pv-card{border:1px solid var(--border);border-radius:12px;padding:12px;background:var(--card-bg);display:flex;flex-direction:column;gap:8px}
.pv-card .form-input{margin:0}
.pv-row{display:flex;align-items:center;gap:8px}
.pv-hora{max-width:130px}
.pv-ev .pv-row{flex-wrap:wrap}
.pv-cuando{flex:1 1 200px;min-width:0}
.pv-x{margin-left:auto;border:0;background:transparent;color:var(--text-faint);font-size:14px;cursor:pointer;padding:6px}
.pv-x:hover{color:var(--ink)}
.pv-mv{display:flex;gap:2px}
.pv-mv button{border:1px solid var(--border);background:var(--bg);color:var(--text-secondary);border-radius:8px;width:32px;height:32px;cursor:pointer;font-size:11px}
.pv-mv button:disabled{opacity:.3;cursor:default}
.pv-lab{font-size:11px;color:var(--text-secondary);margin-top:2px}
.pv-ends{display:flex;justify-content:space-between;font-size:11px;color:var(--text-secondary)}
.pv-hint{font-size:12px;color:var(--text-secondary);background:var(--surface);border-radius:10px;padding:10px 12px;margin-bottom:12px}
.pv-add{width:100%;border:1.5px dashed var(--border-dashed);background:transparent;color:var(--text-secondary);padding:12px;border-radius:12px;font:inherit;font-size:14px;cursor:pointer}
.pv-add:hover{background:var(--surface-hover)}
.pv-end{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--text-faint);margin:4px 0 8px}
.pv-read{font-size:14px;color:var(--ink)}
.pv-read b{font-weight:600;font-variant-numeric:tabular-nums;margin-right:4px}
.pv-read-sub{font-size:12px;color:var(--text-secondary)}

/* Consultante: llenarla en hoja */
.pv-sheet-btns{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.pv-sheet-btns .btn-secondary{flex:1 1 180px;margin-top:0;font-size:14px;text-align:center}
.pv-upload{display:block;cursor:pointer}
.pv-msg{font-size:12px;color:var(--text-secondary);margin-top:8px}
.pv-fotos{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px;margin-top:12px}
.pv-foto{position:relative}
.pv-foto img{width:100%;aspect-ratio:3/4;object-fit:cover;border-radius:8px;border:1px solid var(--border);display:block}
.pv-foto .pv-x{position:absolute;top:4px;right:4px;background:var(--bg);border-radius:50%;width:26px;height:26px;padding:0}

/* La hoja (vista del psicólogo e impresión) */
.pv-sheet{overflow-x:auto}
.pv-tab{width:100%;border-collapse:collapse;font-size:12px;min-width:460px;margin-top:10px}
.pv-tab th{text-align:left;font-weight:500;color:var(--text-secondary);border-bottom:1px solid var(--border-medium);padding:6px 4px}
.pv-tab td{border-bottom:1px solid var(--border);padding:8px 4px;height:32px;vertical-align:middle}
.pv-h{color:var(--text-faint);width:48px;font-variant-numeric:tabular-nums}
.pv-faces{white-space:nowrap;font-size:15px;letter-spacing:4px;filter:grayscale(1);opacity:.75}
.pv-circ{white-space:nowrap}
.pv-circ i{display:inline-block;width:16px;height:16px;border:1px solid var(--text-faint);border-radius:50%;margin-right:3px;font-style:normal;font-size:9px;text-align:center;line-height:15px;color:var(--text-faint)}
.pv-box{display:inline-block;width:30px;height:24px;border:1px solid var(--text-faint);border-radius:6px}
.pv-hist td:last-child{width:150px}
.pv-foot{display:flex;flex-direction:column;gap:14px;font-size:12px;color:var(--text-strong);margin-top:18px}
.pv-foot span{color:var(--text-secondary)}
.pv-legend{font-size:11px;color:var(--text-secondary);margin-top:12px}
.pv-pline{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--text-secondary);margin-top:8px}
.pv-pline i{flex:1;height:10px;border-top:2px solid var(--camino-line);background-image:repeating-linear-gradient(90deg,var(--camino-line) 0 2px,transparent 2px 10%)}

/* Vista previa en Nueva actividad */
#pv-preview{border:1px solid var(--border);border-radius:14px;padding:14px;background:var(--surface);margin-bottom:16px}
.pv-preview-warn{font-size:12px;color:var(--warn-text);background:var(--warn-bg);border:1px solid var(--warn-border);border-radius:10px;padding:10px 12px;margin-bottom:10px}
.pv-preview-sub{font-size:12px;color:var(--text-secondary);margin:-4px 0 10px}
.pv-paper{background:#fff;color:#1a1a1a;border:1px solid var(--border);border-radius:6px;padding:22px 18px;box-shadow:0 8px 24px rgba(0,0,0,.06);overflow-x:auto;
  --ink:#1a1a1a;--text-secondary:#767676;--text-faint:#999;--text-strong:#555;--border:#ebebeb;--border-medium:#d0d0d0;--camino-line:#e4ddcd}
.pv-print-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;border-bottom:2px solid #1a1a1a;padding-bottom:10px;flex-wrap:wrap}
.pv-print-head p{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#999;margin:0}
.pv-print-head h2{font-size:18px;margin:4px 0 0}
.pv-print-name{font-size:12px;color:#555;line-height:2}
.pv-print-inst{font-size:12px;color:#555;margin:12px 0}

/* Imprimir o guardar PDF: solo la hoja, siempre en blanco y negro sobre blanco. */
#pv-print-root{display:none}
@media print{
  @page{margin:14mm}
  html:has(body.pv-printing),body.pv-printing{height:auto!important;min-height:0!important;overflow:visible!important;background:#fff!important}
  body.pv-printing>*:not(#pv-print-root){display:none!important}
  body.pv-printing #pv-print-root{display:block;color:#1a1a1a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    --ink:#1a1a1a;--text-secondary:#767676;--text-faint:#999;--text-strong:#555;--border:#ebebeb;--border-medium:#d0d0d0;--camino-line:#e4ddcd}
  .pv-print-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;border-bottom:2px solid #1a1a1a;padding-bottom:10px}
  .pv-print-head p{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#999;margin:0}
  .pv-print-head h2{font-size:20px;margin:4px 0 0}
  .pv-print-name{font-size:12px;color:#555;line-height:2}
  .pv-print-inst{font-size:12px;color:#555;margin:12px 0}
  #pv-print-root .pv-tab{min-width:0}
  #pv-print-root .pv-tab td{height:36px}
}

/* Hoja de la actividad con el diseño de Documentos (actividad-hoja.js) */
.act-sheet-pages .dx-fsheet,#act-print-root .dx-fsheet{--camino-line:#d8d0bd;--text-secondary:#767676;--text-faint:#999}
.act-sheet-pages .dx-fs-date,#act-print-root .dx-fs-date{white-space:nowrap;padding-left:.8em}
.dx-act-inst{margin-top:.6em;color:#333}
.dx-act-ends{font-size:.82em;color:#555;margin-top:.25em}
.act-pv-t{width:100%;border-collapse:collapse;table-layout:fixed;font-size:.9em}
.act-pv-t th,.act-pv-t td{border:1px solid #9a9a9a;padding:.15em .4em;height:1.55em;text-align:left;vertical-align:middle;overflow:hidden;white-space:nowrap}
.act-pv-t:not(.head) td{border-top:0}
.act-pv-t th{background:#f2f2f2;font-weight:700;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.act-pv-t td:nth-child(n+4){color:#888;font-size:.92em}
.act-pv-t td.tall{height:2.1em}
/* Hoja ya respondida: el texto se ve completo y en negro. */
.act-pv-t.filled td{white-space:normal;overflow-wrap:anywhere;vertical-align:top;color:inherit;font-size:1em;padding:.25em .4em}
.act-sheet-filled + .btn-secondary{width:auto;padding:10px 16px}
.dx-fsheet .pv-box{width:1.6em;height:1.2em;border-color:#999;border-radius:.3em;vertical-align:middle}
.dx-fsheet .pv-pline{font-size:.9em;color:#767676}

/* Imprimir o guardar PDF: solo las hojas, una por página, sin márgenes extra. */
#act-print-root{display:none}
@media print{
  html:has(body.act-printing),body.act-printing{height:auto!important;min-height:0!important;overflow:visible!important;background:#fff!important}
  body.act-printing>*:not(#act-print-root){display:none!important}
  body.act-printing #act-print-root{display:block}
  #act-print-root .dx-sheet-wrap{gap:0}
  #act-print-root .dx-fsheet{border:0;border-radius:0;box-shadow:none;aspect-ratio:auto;height:99.5vh;break-after:page;page-break-after:always}
  #act-print-root .dx-fsheet:last-child{break-after:auto;page-break-after:auto}
}

/* El plan de alimentación como documento (planes.js) */
.dx-plan-meal{display:flex;justify-content:space-between;align-items:baseline;gap:1em}
.dx-plan-meal small{font-size:.82em;font-weight:400;text-transform:none;color:#555}
.dx-plan-item{margin:.25em 0 0 .6em}
.dx-plan-ideas{margin-top:.4em;font-style:italic;color:#444;white-space:pre-line}
.dx-plan-notes{margin-top:.4em;white-space:pre-line}
