
.tpl-stock-picker{width:min(760px,calc(100vw - 32px));max-height:88vh}
.tpl-stock-picker .modal-body{max-height:82vh;overflow:auto}
.tpl-picker-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:14px 0}
.tpl-picker-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid rgba(80,130,90,.35);border-radius:10px;background:rgba(0,0,0,.18);cursor:pointer}
.tpl-picker-item.disabled{opacity:.45;cursor:not-allowed}.tpl-picker-item input{width:18px;height:18px;accent-color:#65a96f}
.tpl-picker-item span{display:flex;flex-direction:column}.tpl-picker-item small{font-size:.72rem;opacity:.7}
.tpl-picker-actions{display:flex;justify-content:flex-end;gap:8px;padding-top:10px;border-top:1px solid rgba(80,130,90,.22)}
.tpl-selected-stock{display:grid;gap:6px;margin-top:10px}.tpl-selected-stock-item{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border-radius:9px;background:rgba(0,0,0,.16);border:1px solid rgba(80,130,90,.25)}
.tpl-selected-stock-item>div{display:flex;flex-direction:column}.tpl-selected-stock-item small{font-size:.72rem;opacity:.65}.tpl-remove-stock{border:0;background:transparent;color:#d48b8b;cursor:pointer}
.tpl-no-selection{opacity:.55;font-size:.8rem;padding:8px 0}@media(max-width:650px){.tpl-picker-list{grid-template-columns:1fr}}

/* GP-TPL-PICKER-V2 — tarjetas de selección en cuadrícula */
.tpl-selected-stock{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:10px!important;
  margin-top:12px!important;
}
.tpl-selected-stock-item{
  min-width:0!important;
  min-height:88px!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:stretch!important;
  justify-content:space-between!important;
  padding:11px!important;
  border-radius:12px!important;
  background:rgba(16,35,21,.78)!important;
  border:1px solid #294832!important;
  box-shadow:0 6px 18px rgba(0,0,0,.12)!important;
}
.tpl-selected-stock-item>div{
  min-width:0!important;
  gap:4px!important;
}
.tpl-selected-stock-item strong{
  display:block!important;
  font-size:.86rem!important;
  line-height:1.2!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.tpl-selected-stock-item small{
  display:block!important;
  font-size:.7rem!important;
  color:var(--muted)!important;
}
.tpl-remove-stock{
  align-self:flex-end!important;
  width:28px!important;
  height:28px!important;
  border:1px solid rgba(190,100,100,.35)!important;
  border-radius:7px!important;
  background:rgba(100,30,30,.18)!important;
}
.tpl-stock-picker{
  width:min(900px,calc(100vw - 36px))!important;
  max-width:900px!important;
  background:#102316!important;
  border:1px solid #294832!important;
  border-radius:16px!important;
  box-shadow:0 24px 70px rgba(0,0,0,.55)!important;
}
.tpl-stock-picker .stock-head{
  margin-bottom:12px!important;
}
.tpl-stock-picker .modal-body{
  padding:18px!important;
}
.tpl-picker-list{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:10px!important;
  max-height:56vh!important;
  overflow:auto!important;
  padding:3px!important;
}
.tpl-picker-item{
  position:relative!important;
  min-height:105px!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  padding:11px!important;
  border:1px solid #294832!important;
  border-radius:12px!important;
  background:rgba(0,0,0,.20)!important;
  color:#edf8ef!important;
}
.tpl-picker-item:hover{
  border-color:#4e8058!important;
  background:rgba(30,65,38,.55)!important;
}
.tpl-picker-item input{
  position:absolute!important;
  top:10px!important;
  right:10px!important;
  width:18px!important;
  height:18px!important;
}
.tpl-picker-item span{
  width:calc(100% - 24px)!important;
  margin-top:23px!important;
}
.tpl-picker-item strong{
  font-size:.86rem!important;
  line-height:1.25!important;
}
.tpl-picker-item small{
  margin-top:5px!important;
  line-height:1.25!important;
}
.tpl-picker-actions{
  margin-top:12px!important;
  padding-top:12px!important;
}
@media(max-width:850px){
  .tpl-picker-list,.tpl-selected-stock{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:520px){
  .tpl-picker-list,.tpl-selected-stock{grid-template-columns:1fr!important}
}

/* GP-TPL-CARDS-V3 */
.tpl-selected-stock{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:14px!important;
  width:100%!important;
  margin:14px 0 0!important;
}
.tpl-selected-card{
  position:relative!important;
  min-width:0!important;
  min-height:190px!important;
  padding:12px!important;
  display:flex!important;
  flex-direction:column!important;
  justify-content:flex-start!important;
  border:1px solid rgba(99,160,105,.32)!important;
  border-radius:14px!important;
  background:linear-gradient(145deg,rgba(24,48,29,.98),rgba(13,29,18,.98))!important;
  box-shadow:0 8px 24px rgba(0,0,0,.18)!important;
  overflow:hidden!important;
}
.tpl-selected-card-image{
  height:76px!important;
  width:100%!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  border-radius:10px!important;
  background:rgba(0,0,0,.18)!important;
  overflow:hidden!important;
  margin-bottom:9px!important;
}
.tpl-selected-card-image img{
  width:100%!important;height:100%!important;object-fit:cover!important;
}
.tpl-selected-stock-placeholder{
  font-size:2rem!important;
  opacity:.7!important;
}
.tpl-selected-card-body{
  min-width:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:3px!important;
  padding-right:18px!important;
}
.tpl-selected-card-body strong{
  font-size:.92rem!important;
  line-height:1.2!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.tpl-selected-card-body span{
  font-size:.75rem!important;
  color:var(--muted)!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.tpl-selected-card-body small{
  font-size:.7rem!important;
  color:rgba(235,247,237,.68)!important;
}
.tpl-remove-stock{
  position:absolute!important;
  right:9px!important;
  top:9px!important;
  width:25px!important;
  height:25px!important;
  padding:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  border-radius:7px!important;
  border:1px solid rgba(190,100,100,.35)!important;
  background:rgba(100,30,30,.18)!important;
  color:#e39b9b!important;
  cursor:pointer!important;
}
.tpl-solo-riego{
  margin-top:auto!important;
  padding-top:10px!important;
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
  font-size:.74rem!important;
  color:#dbeedd!important;
  cursor:pointer!important;
}
.tpl-solo-riego input{
  width:17px!important;
  height:17px!important;
  margin:0!important;
  accent-color:#72b77b!important;
}
.tpl-stock-picker-overlay{z-index:99999!important}
.tpl-picker-dialog{
  width:min(1050px,calc(100vw - 32px))!important;
  max-height:90vh!important;
  padding:20px!important;
  border-radius:18px!important;
  background:linear-gradient(145deg,#142b1a,#0c1d12)!important;
  border:1px solid rgba(99,160,105,.36)!important;
  box-shadow:0 28px 90px rgba(0,0,0,.6)!important;
  color:var(--text,#edf7ef)!important;
}
.tpl-picker-close{
  position:absolute!important;
  top:12px!important;
  right:12px!important;
  width:34px!important;
  height:34px!important;
  border:1px solid rgba(99,160,105,.3)!important;
  border-radius:9px!important;
  background:rgba(0,0,0,.18)!important;
  color:inherit!important;
}
.tpl-picker-header{padding:4px 44px 14px 2px!important}
.tpl-picker-kicker{font-size:.68rem!important;letter-spacing:.12em!important;color:#78ad7e!important}
.tpl-picker-header h2{margin:4px 0!important;font-size:1.25rem!important}
.tpl-picker-header p{margin:5px 0 0!important;color:var(--muted)!important;font-size:.78rem!important}
.tpl-picker-grid{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:12px!important;
  max-height:58vh!important;
  overflow:auto!important;
  padding:4px!important;
}
.tpl-picker-card{
  position:relative!important;
  min-width:0!important;
  min-height:205px!important;
  padding:11px!important;
  display:flex!important;
  flex-direction:column!important;
  border-radius:13px!important;
  border:1px solid rgba(99,160,105,.27)!important;
  background:rgba(0,0,0,.16)!important;
  cursor:pointer!important;
  transition:.15s ease!important;
}
.tpl-picker-card:hover{border-color:rgba(117,184,124,.7)!important;transform:translateY(-1px)!important}
.tpl-picker-card.is-used{opacity:.42!important;cursor:not-allowed!important}
.tpl-picker-check{
  position:absolute!important;
  top:11px!important;
  right:11px!important;
  width:19px!important;
  height:19px!important;
  z-index:2!important;
  accent-color:#72b77b!important;
}
.tpl-picker-image{
  width:100%!important;
  height:88px!important;
  margin-bottom:9px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
  border-radius:9px!important;
  background:rgba(0,0,0,.2)!important;
}
.tpl-picker-img{width:100%!important;height:100%!important;object-fit:cover!important}
.tpl-picker-placeholder{font-size:2.2rem!important;opacity:.7!important}
.tpl-picker-card-body{display:flex!important;flex-direction:column!important;gap:3px!important;padding-right:20px!important}
.tpl-picker-card-body strong{font-size:.86rem!important;line-height:1.2!important}
.tpl-picker-secondary,.tpl-picker-stock,.tpl-picker-price{font-size:.7rem!important;color:var(--muted)!important}
.tpl-picker-price{color:#d9eadb!important;margin-top:3px!important}
.tpl-picker-used{margin-top:auto!important;font-size:.65rem!important;color:#d7a4a4!important}
.tpl-picker-footer{
  display:flex!important;
  justify-content:flex-end!important;
  gap:9px!important;
  margin-top:14px!important;
  padding-top:13px!important;
  border-top:1px solid rgba(99,160,105,.2)!important;
}
.tpl-picker-cancel,.tpl-picker-confirm{
  border-radius:9px!important;
  padding:9px 15px!important;
  font-size:.78rem!important;
  cursor:pointer!important;
}
.tpl-picker-cancel{background:rgba(0,0,0,.18)!important;color:inherit!important;border:1px solid rgba(99,160,105,.3)!important}
.tpl-picker-confirm{background:#477d4e!important;color:#fff!important;border:1px solid #5d9864!important}
.tpl-picker-empty{grid-column:1/-1!important;text-align:center!important;padding:35px!important;color:var(--muted)!important}
@media(max-width:900px){
 .tpl-selected-stock,.tpl-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:520px){
 .tpl-selected-stock,.tpl-picker-grid{grid-template-columns:1fr!important}
 .tpl-picker-dialog{padding:14px!important}
}

/* GP-TPL-V4 — selector de cepas/fertilizantes: mismo lenguaje visual que Stock */
.tpl-picker-dialog{
  width:min(960px,calc(100vw - 32px))!important;
  max-height:88vh!important;
  padding:18px!important;
}
.tpl-picker-grid{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:12px!important;
  max-height:58vh!important;
}
.tpl-picker-card{
  min-height:0!important;
  height:205px!important;
  padding:10px!important;
  border-radius:12px!important;
  display:grid!important;
  grid-template-rows:58px auto!important;
  align-content:start!important;
  overflow:hidden!important;
}
.tpl-picker-image{
  width:58px!important;
  height:58px!important;
  margin:0 auto 7px!important;
  border-radius:9px!important;
  flex:none!important;
}
.tpl-picker-img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
}
.tpl-picker-placeholder{font-size:1.55rem!important}
.tpl-picker-card-body{
  min-width:0!important;
  padding:0 2px!important;
  gap:3px!important;
  overflow:hidden!important;
}
.tpl-picker-card-body strong{
  font-size:.82rem!important;
  line-height:1.18!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.tpl-picker-card-body span,
.tpl-picker-card-body small{
  font-size:.68rem!important;
  line-height:1.2!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.tpl-picker-used{
  position:absolute!important;
  left:10px!important;
  bottom:8px!important;
  font-size:.62rem!important;
}
.tpl-picker-check{
  width:17px!important;
  height:17px!important;
  top:9px!important;
  right:9px!important;
}
@media(max-width:900px){
  .tpl-picker-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:520px){
  .tpl-picker-grid{grid-template-columns:1fr!important}
  .tpl-picker-card{height:190px!important}
}

/* GP-TPL-V5 - selector real usado por mejors-templates.js
   Se añade al final para vencer los estilos antiguos V2/V3/V4. */
.tpl-stock-picker-overlay{
  position:fixed!important;
  inset:0!important;
  z-index:999999!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  padding:14px!important;
  background:rgba(0,0,0,.68)!important;
}
#tplStockPicker .tpl-picker-dialog{
  position:relative!important;
  width:min(980px,calc(100vw - 28px))!important;
  max-width:980px!important;
  max-height:90vh!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  padding:18px!important;
  border-radius:16px!important;
  background:linear-gradient(180deg,#0f2416,#08140d)!important;
  border:1px solid #294832!important;
  box-shadow:0 28px 90px rgba(0,0,0,.62)!important;
  color:#edf8ef!important;
}
#tplStockPicker .tpl-picker-header{
  padding:0 42px 12px 0!important;
}
#tplStockPicker .tpl-picker-header h2{
  margin:3px 0 4px!important;
  font-size:1.05rem!important;
}
#tplStockPicker .tpl-picker-header p{
  margin:0!important;
  color:#a4bda9!important;
  font-size:.72rem!important;
}
#tplStockPicker .tpl-picker-grid{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:10px!important;
  max-height:60vh!important;
  overflow:auto!important;
  padding:2px!important;
}
#tplStockPicker .tpl-picker-card{
  position:relative!important;
  min-width:0!important;
  height:168px!important;
  box-sizing:border-box!important;
  display:flex!important;
  flex-direction:column!important;
  padding:9px!important;
  border:1px solid #294832!important;
  border-radius:13px!important;
  background:rgba(0,0,0,.22)!important;
  color:#edf8ef!important;
  cursor:pointer!important;
  overflow:hidden!important;
}
#tplStockPicker .tpl-picker-card:hover{
  border-color:#4f8e5d!important;
  background:rgba(24,58,32,.5)!important;
}
#tplStockPicker .tpl-picker-card.is-used{
  opacity:.42!important;
  cursor:not-allowed!important;
}
#tplStockPicker .tpl-picker-image{
  width:42px!important;
  height:42px!important;
  flex:0 0 42px!important;
  margin:0 0 7px 0!important;
  border-radius:10px!important;
  overflow:hidden!important;
  display:grid!important;
  place-items:center!important;
  background:#10271a!important;
  border:1px solid #294832!important;
}
#tplStockPicker .tpl-picker-img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  display:block!important;
}
#tplStockPicker .tpl-picker-placeholder{
  font-size:20px!important;
  line-height:1!important;
}
#tplStockPicker .tpl-picker-check{
  position:absolute!important;
  top:9px!important;
  right:9px!important;
  width:17px!important;
  height:17px!important;
  margin:0!important;
  accent-color:#65a96f!important;
}
#tplStockPicker .tpl-picker-card-body{
  min-width:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:3px!important;
  padding-right:20px!important;
  overflow:hidden!important;
}
#tplStockPicker .tpl-picker-card-body strong{
  display:block!important;
  font-size:.78rem!important;
  line-height:1.18!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
#tplStockPicker .tpl-picker-card-body span,
#tplStockPicker .tpl-picker-card-body small{
  display:block!important;
  font-size:.66rem!important;
  line-height:1.2!important;
  color:#8fa894!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
#tplStockPicker .tpl-picker-used{
  position:absolute!important;
  left:9px!important;
  bottom:8px!important;
  font-size:.6rem!important;
  color:#d7a4a4!important;
}
#tplStockPicker .tpl-picker-footer{
  display:flex!important;
  justify-content:flex-end!important;
  gap:8px!important;
  margin-top:12px!important;
  padding-top:11px!important;
  border-top:1px solid rgba(41,72,50,.65)!important;
}
#tplStockPicker .tpl-picker-cancel,
#tplStockPicker .tpl-picker-confirm{
  appearance:none!important;
  border-radius:9px!important;
  padding:7px 12px!important;
  font-size:.7rem!important;
  font-weight:800!important;
  cursor:pointer!important;
}
#tplStockPicker .tpl-picker-cancel{
  background:#102318!important;
  color:#d9f3df!important;
  border:1px solid #294832!important;
}
#tplStockPicker .tpl-picker-confirm{
  background:#1c5a2b!important;
  color:#effff1!important;
  border:1px solid #63a96c!important;
}
#tplStockPicker .tpl-picker-close{
  position:absolute!important;
  top:12px!important;
  right:12px!important;
  width:30px!important;
  height:30px!important;
  padding:0!important;
  border-radius:8px!important;
  background:#102318!important;
  color:#d9f3df!important;
  border:1px solid #294832!important;
  cursor:pointer!important;
}
.tpl-strain-selected.tpl-selected-stock,
.tpl-fert-selected.tpl-selected-stock{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:10px!important;
}
#templatesModal .tpl-selected-card{
  min-width:0!important;
  min-height:150px!important;
  box-sizing:border-box!important;
  padding:10px!important;
  background:rgba(0,0,0,.22)!important;
  border:1px solid #294832!important;
  border-radius:13px!important;
}
#templatesModal .tpl-selected-card-image{
  width:42px!important;
  height:42px!important;
  flex:0 0 42px!important;
  margin:0 0 7px!important;
  border-radius:10px!important;
  overflow:hidden!important;
  background:#10271a!important;
}
#templatesModal .tpl-selected-card-image img{
  width:100%!important;
  height:100%!important;
  object-fit:cover!important;
  display:block!important;
}
#templatesModal .tpl-selected-card-body strong{
  font-size:.8rem!important;
}
#templatesModal .tpl-selected-card-body span,
#templatesModal .tpl-selected-card-body small{
  font-size:.66rem!important;
}
#templatesModal .tpl-solo-riego{
  margin-top:auto!important;
  padding-top:7px!important;
  font-size:.68rem!important;
}
@media(max-width:900px){
  #tplStockPicker .tpl-picker-grid,
  .tpl-strain-selected.tpl-selected-stock,
  .tpl-fert-selected.tpl-selected-stock{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
@media(max-width:520px){
  #tplStockPicker .tpl-picker-grid,
  .tpl-strain-selected.tpl-selected-stock,
  .tpl-fert-selected.tpl-selected-stock{
    grid-template-columns:1fr!important;
  }
}


/* GP-TPL-UI-V6 — límites finales de imagen en tarjetas seleccionadas */
#templatesModal .tpl-selected-stock,
#templatesModal .tpl-strain-selected,
#templatesModal .tpl-fert-selected{
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
}
#templatesModal .tpl-selected-card-image{
  width:42px !important;
  height:42px !important;
  min-width:42px !important;
  max-width:42px !important;
  min-height:42px !important;
  max-height:42px !important;
  flex:0 0 42px !important;
  overflow:hidden !important;
  align-self:flex-start !important;
}
#templatesModal .tpl-selected-card-image img{
  display:block !important;
  width:42px !important;
  height:42px !important;
  min-width:42px !important;
  max-width:42px !important;
  min-height:42px !important;
  max-height:42px !important;
  object-fit:cover !important;
}
#templatesModal .tpl-selected-card{
  overflow:hidden !important;
}
@media(max-width:900px){
  #templatesModal .tpl-selected-stock,
  #templatesModal .tpl-strain-selected,
  #templatesModal .tpl-fert-selected{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}
@media(max-width:520px){
  #templatesModal .tpl-selected-stock,
  #templatesModal .tpl-strain-selected,
  #templatesModal .tpl-fert-selected{
    grid-template-columns:1fr !important;
  }
}

/* GP-TPL-STRAIN-QTY-V2 */
#templatesModal .tpl-strain-qty{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  gap:8px!important;margin-top:8px!important;padding-top:7px!important;
  border-top:1px solid rgba(99,160,105,.18)!important;color:#a4bda9!important;font-size:.66rem!important;
}
#templatesModal .tpl-strain-qty span{color:#a4bda9!important;font-size:.64rem!important}
#templatesModal .tpl-strain-plants{
  width:54px!important;min-width:54px!important;height:30px!important;
  padding:4px 6px!important;text-align:center!important;border:1px solid #294832!important;
  border-radius:8px!important;background:#0c1c12!important;color:#edf8ef!important;font-weight:800!important;
}
#templatesModal .tpl-strain-plants:focus{
  outline:none!important;border-color:#63a96c!important;box-shadow:0 0 0 2px rgba(99,169,108,.16)!important;
}
